GetReturnMaterialAuthorizationByKey


Description

Retrieves a single return material authorization object based on the specified service document key.

Parameters

Parameter

Type

Description

key

ServiceDocumentKey

The service document key object that specifies the return materiall authorization to retrieve.

context

Context

Specifies information about how the method will be called.


Return Value:

Value

Type

Description

GetReturnMaterialAuthorizationByKeyResult

ReturnMaterialAuthorization

A return material authorization object.


Interfaces

 

Examples

The following C# example retrieves a return material authorization object with the key ID value of “RMA000000003001”. A message box displays the customer name

 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;
			ServiceDocumentKey serviceDocumentKey;
			ReturnMaterialAuthorization returnMaterialsAuthorization;

			// 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 service document key
			// Specify the RMA document number
			serviceDocumentKey = new ServiceDocumentKey();
			serviceDocumentKey.Id = "RMA000000003001";

			// Retrieve the return materials authorization object
			returnMaterialsAuthorization = wsDynamicsGP.GetReturnMaterialAuthorizationByKey
				(serviceDocumentKey, context);

			// Display the customer name
			MessageBox.Show("Customer name: " + returnMaterialsAuthorization.CustomerName);
	}
}
}

 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)
		{
			CompanyKey companyKey;
			Context context;
			ServiceDocumentKey serviceDocumentKey;
			ReturnMaterialAuthorization returnMaterialsAuthorization;

			// 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 service document key
			// Specify the RMA document number
			serviceDocumentKey = new ServiceDocumentKey();
			serviceDocumentKey.Id = "RMA000000003001";

			// Retrieve the return materials authorization object
			returnMaterialsAuthorization = wsDynamicsGP.GetReturnMaterialAuthorizationByKey
				(serviceDocumentKey, context);

			// Display the customer name
			MessageBox.Show("Customer name: " + returnMaterialsAuthorization.CustomerName);

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


Documentation Feedback