Updates the specified HR requisition object, storing the current values in the database.
Parameter |
Type |
Description |
---|---|---|
businessObject |
The HR requisition 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 and updates the HR requisition with an Id of “1”. The UpdateHRRequisition operation saves the changes made to the requisition to the database.
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; HRRequisitionNumberKey requisitionNumberKey; HRRequisition requisition; Policy requisitionUpdatePolicy; // 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 a requisition number key requisitionNumberKey = new HRRequisitionNumberKey(); requisitionNumberKey.Id = "1"; // Get the specified requisition object requisition = wsDynamicsGP.GetHRRequisitionByKey(requisitionNumberKey, context); // Update the requisition object requisition.PositionsAvailable = 2; // Get the update policy for requisition objects requisitionUpdatePolicy = wsDynamicsGP.GetPolicyByOperation("UpdateHRRequisition", context); // Update the requisition wsDynamicsGP.UpdateHRRequisition(requisition, context, requisitionUpdatePolicy); } } }
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; HRRequisitionNumberKey requisitionNumberKey; HRRequisition requisition; Policy requisitionUpdatePolicy; // 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 a requisition number key requisitionNumberKey = new HRRequisitionNumberKey(); requisitionNumberKey.Id = "1"; // Get the specified requisition object requisition = wsDynamicsGP.GetHRRequisitionByKey(requisitionNumberKey, context); // Update the requisition object requisition.PositionsAvailable = 2; // Get the update policy for requisition objects requisitionUpdatePolicy = wsDynamicsGP.GetPolicyByOperation("UpdateHRRequisition", context); // Update the requisition wsDynamicsGP.UpdateHRRequisition(requisition, context, requisitionUpdatePolicy); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }