Updates the specified applicant object, storing the current values in the database.
Parameter |
Type |
Description |
---|---|---|
businessObject |
The applicant object that is being updated. |
|
context |
Specifies information about how the method will be called. |
|
policy |
Specifies the set of behaviors and behavior options to be applied during the operation. |
The following C# example retrieves the applicant with the key value “1” and sets the AgeCode property. The UpdateApplicant 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; Applicant applicant; ApplicantKey applicantKey; Policy applicantUpdatePolicy; // 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 an applicant key applicantKey = new ApplicantKey(); applicantKey.Id = 1; // Retrieve the specified applicant applicant = wsDynamicsGP.GetApplicantByKey(applicantKey, context); // Change the value of the AgeCode property applicant.AgeCode = AgeCode.EighteenTwentyfive; // Get the update policy for the applicant applicantUpdatePolicy = wsDynamicsGP.GetPolicyByOperation("UpdateApplicant", context); // Update the applicant wsDynamicsGP.UpdateApplicant(applicant, context, applicantUpdatePolicy); } } }
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; Applicant applicant; ApplicantKey applicantKey; Policy applicantUpdatePolicy; // 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 an applicant key applicantKey = new ApplicantKey(); applicantKey.Id = 1; // Retrieve the specified applicant applicant = wsDynamicsGP.GetApplicantByKey(applicantKey, context); // Change the value of the AgeCode property applicant.AgeCode = AgeCode.EighteenTwentyfive; // Get the update policy for the applicant applicantUpdatePolicy = wsDynamicsGP.GetPolicyByOperation("UpdateApplicant", context); // Update the applicant wsDynamicsGP.UpdateApplicant(applicant, context, applicantUpdatePolicy); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }