Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Description
Retrieves a list of salesperson commission objects that match the specified criteria.
Parameters
Parameter |
Type |
Description |
|---|---|---|
criteria |
A salesperson commissions criteria object that specifies which salesperson commissions summary objects to return. |
|
context |
Specifies information about how the method will be called. |
Return Value:
Value |
Type |
Description |
|---|---|---|
GetSalespersonCommissionsListResult |
The list of salesperson commissions summary objects that match the specified criteria. |
Interfaces
- Dynamics GP
- Sales
Examples
The following C# example retrieves a list of salesperson commissions summary objects. The example retrieves a salesperson's commissions on open sales invoices for the customer with a key of "METROPOL0001". The sales amount and commission amount from each salesperson commissions summary object is displayed in a message box.
** Legacy endpoint**
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
LikeRestrictionOfString salespersonIdRestriction;
LikeRestrictionOfString customerIdRestriction;
ListRestrictionOfNullableOfSalespersonCommissionsDocumentType salesDocumentTypeRestriction;
ListRestrictionOfNullableOfSalesCommissionTransactionState transactionStateRestriction;
SalespersonCommissionsCriteria commissionsCriteria;
SalespersonCommissionsSummary[] commissionsSummaries;
// Create an instance of the service
DynamicsGP wsDynamicsGP = new DynamicsGP();
// Be sure the default credentials are used
wsDynamicsGP.UseDefaultCredentials = true;
// Create a context with which to call the service
context = new Context();
// Specify which company to use (sample company)
companyKey = new CompanyKey();
companyKey.Id = (-1);
// Set up the context object
context.OrganizationKey = (OrganizationKey)companyKey;
// Create four restriction objects
// Retrieve a sales person's commissions on open sales invoices for one customer
salespersonIdRestriction = new LikeRestrictionOfString();
salespersonIdRestriction.Like = "SANDRA M.";
customerIdRestriction = new LikeRestrictionOfString();
customerIdRestriction.EqualValue = "METROPOL0001";
salesDocumentTypeRestriction = new
ListRestrictionOfNullableOfSalespersonCommissionsDocumentType();
salesDocumentTypeRestriction.EqualValue = SalespersonCommissionsDocumentType.SalesInvoice;
transactionStateRestriction = new ListRestrictionOfNullableOfSalesCommissionTransactionState();
transactionStateRestriction.EqualValue = SalesCommissionTransactionState.Open;
// Create the criteria object
commissionsCriteria = new SalespersonCommissionsCriteria();
commissionsCriteria.SalespersonId = salespersonIdRestriction;
commissionsCriteria.CustomerId = customerIdRestriction;
commissionsCriteria.DocumentType = salesDocumentTypeRestriction;
commissionsCriteria.TransactionState = transactionStateRestriction;
// Retrieve the list of salespersons commissions summary objects
commissionsSummaries = wsDynamicsGP.GetSalespersonCommissionsList(commissionsCriteria, context);
// Display the sales amount and commission amount for each member of the summary object list
StringBuilder summaryList = new StringBuilder();
foreach (SalespersonCommissionsSummary a in commissionsSummaries)
{
summaryList.AppendLine("Sales amount: " + a.SalesAmount.Value.ToString("C")
+ " Commission amount: " + a.Amount.Value.ToString("C"));
}
MessageBox.Show(summaryList.ToString());
}
}
}
** Native endpoint **
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
LikeRestrictionOfstring salespersonIdRestriction;
LikeRestrictionOfstring customerIdRestriction;
ListRestrictionOfNullableOfSalespersonCommissionsDocumentType salesDocumentTypeRestriction;
ListRestrictionOfNullableOfSalesCommissionTransactionState transactionStateRestriction;
SalespersonCommissionsCriteria commissionsCriteria;
SalespersonCommissionsSummary[] commissionsSummaries;
// Create an instance of the service
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();
// Create a context with which to call the service
context = new Context();
// Specify which company to use (sample company)
companyKey = new CompanyKey();
companyKey.Id = (-1);
// Set up the context object
context.OrganizationKey = (OrganizationKey)companyKey;
// Create four restriction objects
// Retrieve a sales person's commissions on open sales invoices for one customer
salespersonIdRestriction = new LikeRestrictionOfstring();
salespersonIdRestriction.Like = "SANDRA M.";
customerIdRestriction = new LikeRestrictionOfstring();
customerIdRestriction.EqualValue = "METROPOL0001";
salesDocumentTypeRestriction = new
ListRestrictionOfNullableOfSalespersonCommissionsDocumentType();
salesDocumentTypeRestriction.EqualValue = SalespersonCommissionsDocumentType.SalesInvoice;
transactionStateRestriction = new ListRestrictionOfNullableOfSalesCommissionTransactionState();
transactionStateRestriction.EqualValue = SalesCommissionTransactionState.Open;
// Create the criteria object
commissionsCriteria = new SalespersonCommissionsCriteria();
commissionsCriteria.SalespersonId = salespersonIdRestriction;
commissionsCriteria.CustomerId = customerIdRestriction;
commissionsCriteria.DocumentType = salesDocumentTypeRestriction;
commissionsCriteria.TransactionState = transactionStateRestriction;
// Retrieve the list of salespersons commissions summary objects
commissionsSummaries = wsDynamicsGP.GetSalespersonCommissionsList(commissionsCriteria, context);
// Display the sales amount and commission amount for each member of the summary object list
StringBuilder summaryList = new StringBuilder();
foreach (SalespersonCommissionsSummary a in commissionsSummaries)
{
summaryList.AppendLine("Sales amount: " + a.SalesAmount.Value.ToString("C")
+ " Commission amount: " + a.Amount.Value.ToString("C"));
}
MessageBox.Show(summaryList.ToString());
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}