UpdateReturnMaterialAuthorization


Description

Updates the specified return material authorization object, storing the current values in the database.

Parameters

Parameter

Type

Description

returnMaterialAuthorization

ReturnMaterialAuthorization

The return material authorization object that is being updated.

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 retrieves the return material authorizaton document with the service document key value “RMATEST000200” and sets the customer purchase order property to “100”. This example uses the return material authorization document created by the CreateReturnMaterialAuthorization example. The UpdateReturnMaterialAuthorization operation saves the new customer purchase order value and the return material authorization object’s existing properties to the database.

 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;
			ReturnMaterialAuthorizationReasonCodeKey rmaReasonCode;
			Policy returnMaterialAuthorizationUpdatePolicy;

			// 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 return material authorization document number
			serviceDocumentKey = new ServiceDocumentKey();
			serviceDocumentKey.Id = "RMATEST000200";

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

			// Set the customer purchase order number property to '100' 
			returnMaterialsAuthorization.CustomerPONumber = "100";

			// Get the update policy for a return material authorizations
			returnMaterialAuthorizationUpdatePolicy = wsDynamicsGP.GetPolicyByOperation(
				"UpdateReturnMaterialAuthorization", context);

			// Update the specified return material authorization document
			wsDynamicsGP.UpdateReturnMaterialAuthorization(returnMaterialsAuthorization, 
				context, returnMaterialAuthorizationUpdatePolicy);
	}
}
}

 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;
			ReturnMaterialAuthorizationReasonCodeKey rmaReasonCode;
			Policy returnMaterialAuthorizationUpdatePolicy;

			// 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 return material authorization document number
			serviceDocumentKey = new ServiceDocumentKey();
			serviceDocumentKey.Id = "RMATEST000200";

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

			// Set the customer purchase order number property to '100' 
			returnMaterialsAuthorization.CustomerPONumber = "100";

			// Get the update policy for a return material authorizations
			returnMaterialAuthorizationUpdatePolicy = wsDynamicsGP.GetPolicyByOperation(
				"UpdateReturnMaterialAuthorization", context);

			// Update the specified return material authorization document
			wsDynamicsGP.UpdateReturnMaterialAuthorization(returnMaterialsAuthorization, 
				context, returnMaterialAuthorizationUpdatePolicy);

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


Documentation Feedback