UpdateApplicantWorkHistory


Description

Updates the specified applicant work history object, storing the current values in the database.

Parameters

Parameter

Type

Description

businessObject

ApplicantWorkHistory

The applicant work history 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 applicant work history object with the specified applicant work history key. The value of the years of experience property is updated. The UpdateApplicantWorkHistory operation saves the change.

 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;
			ApplicantKey applicantKey;
			SequenceKey sequenceKey;
			ApplicantSequenceKey applicantSequenceKey;
			ApplicantWorkHistoryKey applicantWorkHistoryKey;
			ApplicantWorkHistory applicantWorkHistory;
			Policy applicantWorkHistoryUpdatePolicy;

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

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

			// Create an applicant key
			applicantKey = new ApplicantKey();
			applicantKey.Id = 1;

			// Create a sequence key
			sequenceKey = new SequenceKey();
			sequenceKey.Id = 1;

			// Create an applicant sequence key
			applicantSequenceKey = new ApplicantSequenceKey();
			applicantSequenceKey.ApplicantKey = applicantKey;
			applicantSequenceKey.SequenceKey = sequenceKey;

			// Create an applicant work history key
			applicantWorkHistoryKey = new ApplicantWorkHistoryKey();
			applicantWorkHistoryKey.ApplicantSequenceKey = applicantSequenceKey;
			applicantWorkHistoryKey.Id = "Previous employer";

			// Retrieve the applicant work history object
			applicantWorkHistory = wsDynamicsGP.GetApplicantWorkHistoryByKey(
				applicantWorkHistoryKey, context);

			// Update the years of experience property of the work history object
			applicantWorkHistory.YearsOfExperience = 4;

			// Get the update policy for applicant work history objects
			applicantWorkHistoryUpdatePolicy = wsDynamicsGP.GetPolicyByOperation(
				"UpdateApplicantWorkHistory", context);

			// Update the applicant work history
			wsDynamicsGP.UpdateApplicantWorkHistory(applicantWorkHistory, context, applicantWorkHistoryUpdatePolicy);
	}
}
}

 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;
			ApplicantKey applicantKey;
			SequenceKey sequenceKey;
			ApplicantSequenceKey applicantSequenceKey;
			ApplicantWorkHistoryKey applicantWorkHistoryKey;
			ApplicantWorkHistory applicantWorkHistory;
			Policy applicantWorkHistoryUpdatePolicy;

			// 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
			context.OrganizationKey = (OrganizationKey)companyKey;

			// Create an applicant key
			applicantKey = new ApplicantKey();
			applicantKey.Id = 1;

			// Create a sequence key
			sequenceKey = new SequenceKey();
			sequenceKey.Id = 1;

			// Create an applicant sequence key
			applicantSequenceKey = new ApplicantSequenceKey();
			applicantSequenceKey.ApplicantKey = applicantKey;
			applicantSequenceKey.SequenceKey = sequenceKey;

			// Create an applicant work history key
			applicantWorkHistoryKey = new ApplicantWorkHistoryKey();
			applicantWorkHistoryKey.ApplicantSequenceKey = applicantSequenceKey;
			applicantWorkHistoryKey.Id = "Previous employer";

			// Retrieve the applicant work history object
			applicantWorkHistory = wsDynamicsGP.GetApplicantWorkHistoryByKey(
				applicantWorkHistoryKey, context);

			// Update the years of experience property of the work history object
			applicantWorkHistory.YearsOfExperience = 4;

			// Get the update policy for applicant work history objects
			applicantWorkHistoryUpdatePolicy = wsDynamicsGP.GetPolicyByOperation(
				"UpdateApplicantWorkHistory", context);

			// Update the applicant work history
			wsDynamicsGP.UpdateApplicantWorkHistory(applicantWorkHistory, context, applicantWorkHistoryUpdatePolicy);

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


Documentation Feedback