UpdateSkillSet

Description

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

Parameters

Parameter

Type

Description

businessObject

SkillSet

The skill set 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

  • Dynamics GP
  • Human Resources/Payroll

Examples

The following C# example updates a skill set object with the skill set key ID value "New test skill set". The UpdateSkillSet operation saves the change to the database.

Ff623132.LegacyEndpoint(en-us,MSDN.10).gif** 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;
            SkillSet skillSet;
            SkillSetKey skillSetKey;
            Policy skillSetUpdatePolicy;

            // 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 set key
            skillSetKey = new SkillSetKey();
            skillSetKey.Id = "New test skill set";

            // Retrieve the specified skill set object
            skillSet = wsDynamicsGP.GetSkillSetByKey(skillSetKey, context);

            // Change one of the skills associated with the skill set
            SkillKey skillKey = new SkillKey();
            skillKey.Id = "test skills";
            Skill skill = wsDynamicsGP.GetSkillByKey(skillKey, context);
            skillSet.Skills[0] = skill;

            // Get the update policy for skill set objects
            skillSetUpdatePolicy = wsDynamicsGP.GetPolicyByOperation(
                "UpdateSkillset", context);

            // Update the skill set information
            wsDynamicsGP.UpdateSkillSet(skillSet, context, skillSetUpdatePolicy);
        }
    }
}

Ff623132.NativeEndpoint(en-us,MSDN.10).gif** Native endpoint **

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using DynamicsGPWebServiceSample.DynamicsGPService;

namespace DynamicsGPWebServiceSample
{
    class Program
    {
        static void Main(string[] args)
        {
            CompanyKey companyKey;
            Context context;
            SkillSet skillSet;
            SkillSetKey skillSetKey;
            Policy skillSetUpdatePolicy;

            // 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 set key
            skillSetKey = new SkillSetKey();
            skillSetKey.Id = "New test skill set";

            // Retrieve the specified skill set object
            skillSet = wsDynamicsGP.GetSkillSetByKey(skillSetKey, context);

            // Change one of the skills associated with the skill set
            SkillKey skillKey = new SkillKey();
            skillKey.Id = "test skills";
            Skill skill = wsDynamicsGP.GetSkillByKey(skillKey, context);
            skillSet.Skills[0] = skill;

            // Get the update policy for skill set objects
            skillSetUpdatePolicy = wsDynamicsGP.GetPolicyByOperation(
                "UpdateSkillset", context);

            // Update the skill set information
            wsDynamicsGP.UpdateSkillSet(skillSet, context, skillSetUpdatePolicy);

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