Retrieves a list of receivables return summary objects that match the specified criteria.
Parameter |
Type |
Description |
---|---|---|
criteria |
A receivables return criteria object that specifies which receivables return summary objects are retrieved. |
|
context |
Specifies information about how the method will be called. |
Value |
Type |
Description |
---|---|---|
GetReceivablesReturnListResult |
The list of receivables return summary objects that match the specified criteria. |
The following C# example retrieves the list of receivables return summary objects with a SalespersonId of “Nancy B.“. A message box displays the date and amount from each receivables return summary object.
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 salespersonRestriction; ReceivablesReturnCriteria receivablesReturnCriteria; ReceivablesReturnSummary[] receivablesReturnSummaries; // 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 a restriction object // Retrieve all receivables return summary objects for salesperson 'Nancy B.' salespersonRestriction = new LikeRestrictionOfString(); salespersonRestriction.EqualValue = "Nancy B."; // Create the receivables return criteria object receivablesReturnCriteria = new ReceivablesReturnCriteria(); receivablesReturnCriteria.SalespersonId = salespersonRestriction; // Retrieve the list of receivables return summary objects receivablesReturnSummaries = wsDynamicsGP.GetReceivablesReturnList( receivablesReturnCriteria, context); // Display the date and amount for each member of the summary object list StringBuilder summaryList = new StringBuilder(); foreach (ReceivablesReturnSummary a in receivablesReturnSummaries) { summaryList.AppendLine("Return date: " + a.Date.Value.ToShortDateString() + " Returned amount: " + a.DocumentAmount.Value.ToString("C")); } MessageBox.Show(summaryList.ToString()); } } }
Native endpoint
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using DynamicsGPWebServiceSample.DynamicsGPService; namespace DynamicsGPWebServiceSample { class Program static void Main(string[] args) { CompanyKey companyKey; Context context; LikeRestrictionOfstring salespersonRestriction; ReceivablesReturnCriteria receivablesReturnCriteria; ReceivablesReturnSummary[] receivablesReturnSummaries; // 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 a restriction object // Retrieve all receivables return summary objects for salesperson 'Nancy B.' salespersonRestriction = new LikeRestrictionOfstring(); salespersonRestriction.EqualValue = "Nancy B."; // Create the receivables return criteria object receivablesReturnCriteria = new ReceivablesReturnCriteria(); receivablesReturnCriteria.SalespersonId = salespersonRestriction; // Retrieve the list of receivables return summary objects receivablesReturnSummaries = wsDynamicsGP.GetReceivablesReturnList( receivablesReturnCriteria, context); // Display the date and amount for each member of the summary object list StringBuilder summaryList = new StringBuilder(); foreach (ReceivablesReturnSummary a in receivablesReturnSummaries) { summaryList.AppendLine("Return date: " + a.Date.Value.ToShortDateString() + " Returned amount: " + a.DocumentAmount.Value.ToString("C")); } MessageBox.Show(summaryList.ToString()); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }