Share via


CreateApplicantSkill

Description

This method creates a new applicant skill entry for a specified applicant.

Parameters

Parameter

Type

Description

businessObject

ApplicantSkill

The applicant skill object being created.

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 creates a new applicant skill entry for an applicant. The ApplicantKey property of the ApplicantSkillKey object specifies the applicant. Use the Id property of the SkillKey to identify the skill object.

Ff623129.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;
            ApplicantSkill applicantSkill;
            ApplicantSkillKey applicantSkillKey;
            ApplicantKey applicantKey;
            SkillKey skillKey;
            Policy applicantSkillCreatePolicy;

            // 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 an applicant key object
            applicantKey = new ApplicantKey();
            applicantKey.Id = 1;

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

            // Create an applicant skill key
            applicantSkillKey = new ApplicantSkillKey();
            applicantSkillKey.ApplicantKey = applicantKey;
            applicantSkillKey.SkillKey = skillKey;

            // Create an applicant skill object
            applicantSkill = new ApplicantSkill();

            // Populate the fields of the applicant skill object
            applicantSkill.ApplicantSkillKey = applicantSkillKey;
            applicantSkill.SkillNumber = 1;
            applicantSkill.Comments = "Created applicant skill";

            // Get the create policy for applicant skill objects
            applicantSkillCreatePolicy = wsDynamicsGP.GetPolicyByOperation(
                "CreateApplicantSkill", context);

            // Create the applicant skill record
            wsDynamicsGP.CreateApplicantSkill(applicantSkill,
                context, applicantSkillCreatePolicy);
        }
    }
}

Ff623129.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;
            ApplicantSkill applicantSkill;
            ApplicantSkillKey applicantSkillKey;
            ApplicantKey applicantKey;
            SkillKey skillKey;
            Policy applicantSkillCreatePolicy;

            // 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 an applicant key object
            applicantKey = new ApplicantKey();
            applicantKey.Id = 1;

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

            // Create an applicant skill key
            applicantSkillKey = new ApplicantSkillKey();
            applicantSkillKey.ApplicantKey = applicantKey;
            applicantSkillKey.SkillKey = skillKey;

            // Create an applicant skill object
            applicantSkill = new ApplicantSkill();

            // Populate the fields of the applicant skill object
            applicantSkill.ApplicantSkillKey = applicantSkillKey;
            applicantSkill.SkillNumber = 1;
            applicantSkill.Comments = "Created applicant skill";

            // Get the create policy for applicant skill objects
            applicantSkillCreatePolicy = wsDynamicsGP.GetPolicyByOperation(
                "CreateApplicantSkill", context);

            // Create the applicant skill record
            wsDynamicsGP.CreateApplicantSkill(applicantSkill,
                context, applicantSkillCreatePolicy);

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