CreateReceivablesFinanceCharge


Description

This method creates a new receivables finance charge document.

Parameters

Parameter

Type

Description

receivablesFinanceCharge

ReceivablesFinanceCharge

The receivables finance charge object being created.

context

Context

Specifies information about how the method will be called.

policy

Policy

Specifies the set of behaviors and behavior options to be applied during the operation.


Interfaces

 

Examples

The following C# example creates a receivables finance charge document. The example populates the required Key, CustomerKey, and SalesAmount properties. All other receivables finance charge properties are set to default values. The CreateReceivablesFinanceCharge operation saves the new receivables finance charge 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 financeChargeKey;
			CustomerKey customerKey;
			MoneyAmount financeChargeAmount;
			ReceivablesFinanceCharge receivablesFinanceCharge;
			Policy receivablesFinanceChargeCreatePolicy;

			// 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 finance charge
			financeChargeKey = new ReceivablesDocumentKey();
			financeChargeKey.Id = "FC6500";

			// Create a customer key object to specify the customer
			customerKey = new CustomerKey();
			customerKey.Id = "AARONFIT0001";

			// Create a money amount object to specify the finance charge amount
			financeChargeAmount = new MoneyAmount();
			financeChargeAmount.Currency = "USD";
			financeChargeAmount.Value = 381m;

			// Create the receivables finance charge object
			receivablesFinanceCharge = new ReceivablesFinanceCharge();

			// Populate the receivables finance charge object's required properties
			receivablesFinanceCharge.Key = financeChargeKey;
			receivablesFinanceCharge.CustomerKey = customerKey;
			receivablesFinanceCharge.SalesAmount = financeChargeAmount;

			// Get the create policy for receivables finance charge objects
			receivablesFinanceChargeCreatePolicy = wsDynamicsGP.GetPolicyByOperation(
			"CreateReceivablesFinanceCharge", context);

			// Create the receivables finance charge
			wsDynamicsGP.CreateReceivablesFinanceCharge(receivablesFinanceCharge,
			context, receivablesFinanceChargeCreatePolicy);
	}
}
}

 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 financeChargeKey;
			CustomerKey customerKey;
			MoneyAmount financeChargeAmount;
			ReceivablesFinanceCharge receivablesFinanceCharge;
			Policy receivablesFinanceChargeCreatePolicy;

			// 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 finance charge
			financeChargeKey = new ReceivablesDocumentKey();
			financeChargeKey.Id = "FC6500";

			// Create a customer key object to specify the customer
			customerKey = new CustomerKey();
			customerKey.Id = "AARONFIT0001";

			// Create a money amount object to specify the finance charge amount
			financeChargeAmount = new MoneyAmount();
			financeChargeAmount.Currency = "USD";
			financeChargeAmount.Value = 381m;

			// Create the receivables finance charge object
			receivablesFinanceCharge = new ReceivablesFinanceCharge();

			// Populate the receivables finance charge object's required properties
			receivablesFinanceCharge.Key = financeChargeKey;
			receivablesFinanceCharge.CustomerKey = customerKey;
			receivablesFinanceCharge.SalesAmount = financeChargeAmount;

			// Get the create policy for receivables finance charge objects
			receivablesFinanceChargeCreatePolicy = wsDynamicsGP.GetPolicyByOperation(
			"CreateReceivablesFinanceCharge", context);

			// Create the receivables finance charge
			wsDynamicsGP.CreateReceivablesFinanceCharge(receivablesFinanceCharge,
			context, receivablesFinanceChargeCreatePolicy);

			// Close the service
			if(wsDynamicsGP.State != CommunicationState.Faulted)
			{
				wsDynamicsGP.Close();
		}
	}
}
}


Documentation Feedback