UpdateServiceCall


Description

Updates the specified service call object, storing the current values in the database.

Parameters

Parameter

Type

Description

serviceCall

ServiceCall

The service call 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 service call document with the service document Id of “SCTEST00100”. This example uses the service call document created by the CreateServiceCall example. The service call priority is updated to “90”. The UpdateServiceCall operation saves the newly assigned priority and the service call object’s other properties to the database.

 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;
			ServiceDocumentKey serviceDocumentKey;
			ServiceCall serviceCall;
			Policy serviceCallUpdatePolicy;

			// 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 object
			serviceDocumentKey = new ServiceDocumentKey();
			serviceDocumentKey.Id = "SCTEST00100";

			// Retrieve the specified service call object
			serviceCall = wsDynamicsGP.GetServiceCallByKey(serviceDocumentKey, context);

			// Update the service call priority property
			serviceCall.Priority = 90;

			// Retrieve the update policy for service call
			serviceCallUpdatePolicy = wsDynamicsGP.GetPolicyByOperation("UpdateServiceCall", context);

			// Update the service call document
			wsDynamicsGP.UpdateServiceCall(serviceCall, context, serviceCallUpdatePolicy);
	}
}
}

 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;
			ServiceDocumentKey serviceDocumentKey;
			ServiceCall serviceCall;
			Policy serviceCallUpdatePolicy;

			// 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 object
			serviceDocumentKey = new ServiceDocumentKey();
			serviceDocumentKey.Id = "SCTEST00100";

			// Retrieve the specified service call object
			serviceCall = wsDynamicsGP.GetServiceCallByKey(serviceDocumentKey, context);

			// Update the service call priority property
			serviceCall.Priority = 90;

			// Retrieve the update policy for service call
			serviceCallUpdatePolicy = wsDynamicsGP.GetPolicyByOperation("UpdateServiceCall", context);

			// Update the service call document
			wsDynamicsGP.UpdateServiceCall(serviceCall, context, serviceCallUpdatePolicy);

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


Documentation Feedback