GetMulticurrencySetupByKey


Description

Retrieves the multicurrency setup object for the current company, based on the key value supplied.

Parameters

Parameter

Type

Description

key

MulticurrencySetupKey

The multicurrency setup key object that specifies the multicurrency setup object to retrieve.

context

Context

Specifies information about how the method will be called.


Return Value:

Value

Type

Description

GetMulticurrencySetupByKeyResult

MulticurrencySetup

A multicurrency setup object.


Interfaces

 

Examples

The following C# example retrieves the multicurrency setup object for the sample company (Fabrikam). The ISO code for the sample company is a known-value so the multicurrency setup key can be created. The reporting currency for the sample company 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)
		{
			Context context;
			CompanyKey companyKey;
			MulticurrencySetup multicurrencySetup;
			MulticurrencySetupKey multicurrencySetupKey;
			CurrencyKey currencyKey;

			// Create an instance of the service
			DynamicsGP wsDynamicsGP = new DynamicsGP();

			// Be sure that default credentials are being used
			wsDynamicsGP.UseDefaultCredentials = true;

			// Create a context with which to call the service
			context = new Context();

			// Create a company key (sample company)
			companyKey = new CompanyKey();
			companyKey.Id = (-1);

			// Set up the context
			context.OrganizationKey = companyKey;

			// Create the multicurrency setup key
			// The key for the sample company is "USD"
			multicurrencySetupKey = new MulticurrencySetupKey();
			currencyKey = new CurrencyKey();
			currencyKey.ISOCode = "USD";
			multicurrencySetupKey.CurrencyKey = currencyKey;

			// Get the multicurrency setup object
			multicurrencySetup = wsDynamicsGP.GetMulticurrencySetupByKey(multicurrencySetupKey, context);

			// Display the reporting currency
			MessageBox.Show(multicurrencySetup.ReportingCurrencyKey.ISOCode);
	}
}
}

 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)
		{
			Context context;
			CompanyKey companyKey;
			MulticurrencySetup multicurrencySetup;
			MulticurrencySetupKey multicurrencySetupKey;
			CurrencyKey currencyKey;

			// Create an instance of the service
			DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();

			// Create a context with which to call the service
			context = new Context();

			// Create a company key (sample company)
			companyKey = new CompanyKey();
			companyKey.Id = (-1);

			// Set up the context
			context.OrganizationKey = companyKey;

			// Create the multicurrency setup key
			// The key for the sample company is "USD"
			multicurrencySetupKey = new MulticurrencySetupKey();
			currencyKey = new CurrencyKey();
			currencyKey.ISOCode = "USD";
			multicurrencySetupKey.CurrencyKey = currencyKey;

			// Get the multicurrency setup object
			multicurrencySetup = wsDynamicsGP.GetMulticurrencySetupByKey(multicurrencySetupKey, context);

			// Display the reporting currency
			MessageBox.Show(multicurrencySetup.ReportingCurrencyKey.ISOCode);

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


Documentation Feedback