Retrieves a list of sales return summary objects that match the specified criteria.
Parameter |
Type |
Description |
---|---|---|
criteria |
A sales return criteria object that specifies which sales return summary objects are returned. |
|
context |
Specifies information about how the method will be called. |
Value |
Type |
Description |
---|---|---|
GetSalesReturnListResult |
The list of sales return summary objects that match the specified criteria. |
The following C# example retrieves the list of sales return summary objects for sales returns whose Sales Transaction State property equals “Work”. The Id and Customer Name property from each sales return 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; ListRestrictionOfNullableOfSalesTransactionState transactionStateRestriction; SalesReturnCriteria salesReturnCriteria; SalesReturnSummary[] salesReturnSummary; // 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 // The SalesTransactionState enumeration specifies the transaction state transactionStateRestriction = new ListRestrictionOfNullableOfSalesTransactionState(); transactionStateRestriction.EqualValue = SalesTransactionState.Work; // Create a sales return criteria object // Retrieve summary objects of sales returns that have not been posted salesReturnCriteria = new SalesReturnCriteria(); salesReturnCriteria.TransactionState = transactionStateRestriction; // Retrieve the sales return summaries specified by the criteria object salesReturnSummary = wsDynamicsGP.GetSalesReturnList(salesReturnCriteria, context); // Display the ID and Name of each member of the summary object list StringBuilder summaryList = new StringBuilder(); foreach (SalesReturnSummary a in salesReturnSummary) { summaryList.AppendLine("ID:" + a.Key.Id + " Customer:" + a.CustomerName); } 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; ListRestrictionOfNullableOfSalesTransactionState transactionStateRestriction; SalesReturnCriteria salesReturnCriteria; SalesReturnSummary[] salesReturnSummary; // 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 // The SalesTransactionState enumeration specifies the transaction state transactionStateRestriction = new ListRestrictionOfNullableOfSalesTransactionState(); transactionStateRestriction.EqualValue = SalesTransactionState.Work; // Create a sales return criteria object // Retrieve summary objects of sales returns that have not been posted salesReturnCriteria = new SalesReturnCriteria(); salesReturnCriteria.TransactionState = transactionStateRestriction; // Retrieve the sales return summaries specified by the criteria object salesReturnSummary = wsDynamicsGP.GetSalesReturnList(salesReturnCriteria, context); // Display the ID and Name of each member of the summary object list StringBuilder summaryList = new StringBuilder(); foreach (SalesReturnSummary a in salesReturnSummary) { summaryList.AppendLine("ID:" + a.Key.Id + " Customer:" + a.CustomerName); } MessageBox.Show(summaryList.ToString()); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }