This method creates a new receivables debit memo document.
Parameter |
Type |
Description |
---|---|---|
receivablesDebitMemo |
The receivables debit memo object being created. |
|
context |
Specifies information about how the method will be called. |
|
policy |
Specifies the set of behaviors and behavior options to be applied during the operation. |
The following C# example creates a receivables debit memo document. The example populates the required Key, CustomerKey, and SalesAmount properties. All other receivables debit memo properties are set to default values. The CreateReceivablesDebitMemo operation saves the new receivables debit memo document.
Legacy endpoint
using System; using System.Collections.Generic; using System.Text; using DynamicsGPWebServiceSample.DynamicsGPService; namespace DynamicsGPWebServiceSample { class Program { static void Main(string[] args) { CompanyKey companyKey; Context context; ReceivablesDocumentKey debitMemoKey; CustomerKey customerKey; MoneyAmount debitMemoAmount; ReceivablesDebitMemo receivablesDebitMemo; Policy receivablesDebitMemoCreatePolicy; // 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 the document key to uniquely identify the receivables debit memo debitMemoKey = new ReceivablesDocumentKey(); debitMemoKey.Id = "DM6500"; // Create a customer key object to specify the customer customerKey = new CustomerKey(); customerKey.Id = "AARONFIT0001"; // Create a money amount object to specify the debit memo amount debitMemoAmount = new MoneyAmount(); debitMemoAmount.Currency = "USD"; debitMemoAmount.Value = 741m; // Create the receivables debit memo object receivablesDebitMemo = new ReceivablesDebitMemo(); // Populate the receivables debit memo object's required properties receivablesDebitMemo.Key = debitMemoKey; receivablesDebitMemo.CustomerKey = customerKey; receivablesDebitMemo.SalesAmount = debitMemoAmount; // Get the create policy for receivables debit memos receivablesDebitMemoCreatePolicy = wsDynamicsGP.GetPolicyByOperation( "CreateReceivablesDebitMemo", context); // Create the receivables debit memo wsDynamicsGP.CreateReceivablesDebitMemo(receivablesDebitMemo, context, receivablesDebitMemoCreatePolicy); } } }
Native endpoint
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DynamicsGPWebServiceSample.DynamicsGPService; namespace DynamicsGPWebServiceSample { class Program { static void Main(string[] args) { CompanyKey companyKey; Context context; ReceivablesDocumentKey debitMemoKey; CustomerKey customerKey; MoneyAmount debitMemoAmount; ReceivablesDebitMemo receivablesDebitMemo; Policy receivablesDebitMemoCreatePolicy; // 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 the document key to uniquely identify the receivables debit memo debitMemoKey = new ReceivablesDocumentKey(); debitMemoKey.Id = "DM6500"; // Create a customer key object to specify the customer customerKey = new CustomerKey(); customerKey.Id = "AARONFIT0001"; // Create a money amount object to specify the debit memo amount debitMemoAmount = new MoneyAmount(); debitMemoAmount.Currency = "USD"; debitMemoAmount.Value = 741m; // Create the receivables debit memo object receivablesDebitMemo = new ReceivablesDebitMemo(); // Populate the receivables debit memo object's required properties receivablesDebitMemo.Key = debitMemoKey; receivablesDebitMemo.CustomerKey = customerKey; receivablesDebitMemo.SalesAmount = debitMemoAmount; // Get the create policy for receivables debit memos receivablesDebitMemoCreatePolicy = wsDynamicsGP.GetPolicyByOperation( "CreateReceivablesDebitMemo", context); // Create the receivables debit memo wsDynamicsGP.CreateReceivablesDebitMemo(receivablesDebitMemo, context, receivablesDebitMemoCreatePolicy); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }