GetReceivablesDebitMemoList
Description
Retrieves a list of receivables debit memo summary objects that match the specified criteria.
Parameters
Parameter |
Type |
Description |
---|---|---|
criteria |
A receivables debit memo criteria object that specifies which receivables debit memo summary objects are returned. |
|
context |
Specifies information about how the method will be called. |
Return Value:
Value |
Type |
Description |
---|---|---|
GetReceivablesDebitMemoListResult |
The list of receivables debit memo summary objects that match the specified criteria. |
Interfaces
- Dynamics GP
- Sales
Examples
The following C# example retrieves a list of receivables debit memo summary objects. The example retrieves debit memo objects whose Key Id starts with "DM" and whose third Key Id character is less than or equal to a "2". A message box displays the customer ID and the debit memo amount for the receivables debit memo summary objects that matched the criteria.
** 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 documentIdRestriction; ReceivablesDebitMemoCriteria debitMemoCriteria; ReceivablesDebitMemoSummary[] debitMemoSummaries; // 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 the range of debit memo objects starting with 'DM' but less than 'DM2' documentIdRestriction = new LikeRestrictionOfString(); documentIdRestriction.From = "DM"; documentIdRestriction.To = "DM2"; // Create the debit memo criteria object debitMemoCriteria = new ReceivablesDebitMemoCriteria(); debitMemoCriteria.DocumentId = documentIdRestriction; // Retrieve the list of debit memo summary objects debitMemoSummaries = wsDynamicsGP.GetReceivablesDebitMemoList(debitMemoCriteria, context); // Display the customer ID and the amount of each member of the summary object list StringBuilder summaryList = new StringBuilder(); foreach (ReceivablesDebitMemoSummary a in debitMemoSummaries) { summaryList.AppendLine("Customer ID: " + a.CustomerKey.Id + " Debit memo 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.ServiceModel; using System.Windows.Forms; using DynamicsGPWebServiceSample.DynamicsGPService; namespace DynamicsGPWebServiceSample { class Program { static void Main(string[] args) { CompanyKey companyKey; Context context; LikeRestrictionOfstring documentIdRestriction; ReceivablesDebitMemoCriteria debitMemoCriteria; ReceivablesDebitMemoSummary[] debitMemoSummaries; // 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 the range of debit memo objects starting with 'DM' but less than 'DM2' documentIdRestriction = new LikeRestrictionOfstring(); documentIdRestriction.From = "DM"; documentIdRestriction.To = "DM2"; // Create the debit memo criteria object debitMemoCriteria = new ReceivablesDebitMemoCriteria(); debitMemoCriteria.DocumentId = documentIdRestriction; // Retrieve the list of debit memo summary objects debitMemoSummaries = wsDynamicsGP.GetReceivablesDebitMemoList(debitMemoCriteria, context); // Display the customer ID and the amount of each member of the summary object list StringBuilder summaryList = new StringBuilder(); foreach (ReceivablesDebitMemoSummary a in debitMemoSummaries) { summaryList.AppendLine("Customer ID: " + a.CustomerKey.Id + " Debit memo amount: " + a.DocumentAmount.Value.ToString("C")); } MessageBox.Show(summaryList.ToString()); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }