GetSkillByKey


Description

Retrieves a skill object based on the specified skill key.

Parameters

Parameter

Type

Description

key

SkillKey

The skill key object that specifies the skill object to retrieve.

context

Context

Specifies information about how the method will be called.


Return Value:

Value

Type

Description

GetSkillByKeyResult

Skill

A skill object.


Interfaces

 

Examples

The following C# example retrieves a skill object with the key value “New test skill”. A message box displays the compensation values associated with the specified skill.

 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;
			Skill skill;
			SkillKey skillKey;

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

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

			// Retrieve the list of skill objects
			skill = wsDynamicsGP.GetSkillByKey(skillKey, context);

			// Display the number of skill objects matching the criteria
			MessageBox.Show("The compensation value for the specified job skill: " +
				skill.Compensation.CompensationAmount.ToString());
	}
}
}

 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;
			Skill skill;
			SkillKey skillKey;

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

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

			// Retrieve the list of skill objects
			skill = wsDynamicsGP.GetSkillByKey(skillKey, context);

			// Display the number of skill objects matching the criteria
			MessageBox.Show("The compensation value for the specified job skill: " +
				skill.Compensation.CompensationAmount.ToString());

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


Documentation Feedback