UpdateSkill


Description

Updates the specified skill object, storing the current values in the database.

Parameters

Parameter

Type

Description

businessObject

Skill

The skill 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 updates a skill object with the skill key ID value “New test skill”. The UpdateSkill operation adds compensation information to the specified skill object.

 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;
			Skill skill;
			SkillKey skillKey;
			Compensation compensation;
			Policy skillUpdatePolicy;

			// 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();

			// Specify which company to use (sample company)
			companyKey = new DynamicsGPService.CompanyKey();
			companyKey.Id = (-1);

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

			// Create a skill key
			skillKey = new SkillKey();
			skillKey.Id = "New test skill";

			// Retrieve the specified skill object
			skill = wsDynamicsGP.GetSkillByKey(skillKey, context);

			// Create a compensation object
			compensation = new Compensation();
			compensation.CompensationAmount = 10;
			compensation.CompensationPeriod = CompensationPeriod.Hourly;

			// Add a compensation object to the skill
			skill.Compensation = compensation;

			// Get the update policy for  skill objects
			skillUpdatePolicy = wsDynamicsGP.GetPolicyByOperation("UpdateSkill", context);

			// Update the skill information
			wsDynamicsGP.UpdateSkill(skill, context, skillUpdatePolicy);
	}
}
}

 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;
			Skill skill;
			SkillKey skillKey;
			Compensation compensation;
			Policy skillUpdatePolicy;

			// 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 DynamicsGPService.CompanyKey();
			companyKey.Id = (-1);

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

			// Create a skill key
			skillKey = new SkillKey();
			skillKey.Id = "New test skill";

			// Retrieve the specified skill object
			skill = wsDynamicsGP.GetSkillByKey(skillKey, context);

			// Create a compensation object
			compensation = new Compensation();
			compensation.CompensationAmount = 10;
			compensation.CompensationPeriod = CompensationPeriod.Hourly;

			// Add a compensation object to the skill
			skill.Compensation = compensation;

			// Get the update policy for  skill objects
			skillUpdatePolicy = wsDynamicsGP.GetPolicyByOperation("UpdateSkill", context);

			// Update the skill information
			wsDynamicsGP.UpdateSkill(skill, context, skillUpdatePolicy);

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


Documentation Feedback