CreateFee


Description

This method creates a new fee item.

Parameters

Parameter

Type

Description

fee

Fee

The fee 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 fee item. The example populates the required Key, Description, and UofMScheduleKey properties. The fee type property uses the default value of “Flat Fee”. The remaining fee properties also use default values. The CreateFee operation saves the new fee.

 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;
			ItemKey itemKey;
			UofMScheduleKey unitOfMeasureKey;
			Fee fee;
			Policy feeCreatePolicy;

			// 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 fee object
			fee = new Fee();

			// Create an item key to identify the fee
			itemKey = new ItemKey();
			itemKey.Id = "TESTFEE0001";

			// Populate the fee object's key with the item key
			fee.Key = itemKey;

			// Create a unit of measure schedule key
			unitOfMeasureKey = new UofMScheduleKey();
			unitOfMeasureKey.Id = "EACH";

			// Populate the fee object's unit of measure schedule key property
			fee.UofMScheduleKey = unitOfMeasureKey;

			// Populate the description property
			fee.Description = "Test Fee Creation";

			// Get the create policy for fee
			feeCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateFee", context);

			// Create the fee
			wsDynamicsGP.CreateFee(fee, context, feeCreatePolicy);
	}
}
}

 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;
			ItemKey itemKey;
			UofMScheduleKey unitOfMeasureKey;
			Fee fee;
			Policy feeCreatePolicy;

			// 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 fee object
			fee = new Fee();

			// Create an item key to identify the fee
			itemKey = new ItemKey();
			itemKey.Id = "TESTFEE0001";

			// Populate the fee object's key with the item key
			fee.Key = itemKey;

			// Create a unit of measure schedule key
			unitOfMeasureKey = new UofMScheduleKey();
			unitOfMeasureKey.Id = "EACH";

			// Populate the fee object's unit of measure schedule key property
			fee.UofMScheduleKey = unitOfMeasureKey;

			// Populate the description property
			fee.Description = "Test Fee Creation";

			// Get the create policy for fee
			feeCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateFee", context);

			// Create the fee
			wsDynamicsGP.CreateFee(fee, context, feeCreatePolicy);

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


Documentation Feedback