Updates the specified employee pay code object, storing the current values in the database.
Parameter |
Type |
Description |
|---|---|---|
employeePayCode |
The employee pay code 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. |
- Dynamics GP
- Human Resources/Payroll
The following C# example retrieves and updates the employee pay code for the employee with an Id of "ACKE0001" and a pay code Id of "COMM". The update sets the PayPeriod property to quarterly. The UpdateEmployeePayCode operation saves the updated employee pay code value to the database.
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;
EmployeePayCode employeePayCode;
EmployeePayCodeKey employeePayCodeKey;
EmployeeKey employeeKey;
PayCodeKey payCodeKey;
Policy employeePayCodeUpdatePolicy;
// 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 employee key
employeeKey = new EmployeeKey();
employeeKey.Id = "ACKE0001";
// Create a pay code key
payCodeKey = new PayCodeKey();
payCodeKey.Id = "COMM";
// Create an employee pay code key
employeePayCodeKey = new EmployeePayCodeKey();
employeePayCodeKey.EmployeeKey = employeeKey;
employeePayCodeKey.PayCodeKey = payCodeKey;
// Get the employee pay code object
employeePayCode = wsDynamicsGP.GetEmployeePayCodeByKey(employeePayCodeKey, context);
// Update the compensation period
employeePayCode.PayPeriod = CompensationPeriod.Quarterly;
// Get the update policy for employee pay code objects
employeePayCodeUpdatePolicy = wsDynamicsGP.GetPolicyByOperation(
"UpdateEmployeePayCode", context);
// Update the employee pay code object
wsDynamicsGP.UpdateEmployeePayCode(employeePayCode, context, employeePayCodeUpdatePolicy);
}
}
}
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;
EmployeePayCode employeePayCode;
EmployeePayCodeKey employeePayCodeKey;
EmployeeKey employeeKey;
PayCodeKey payCodeKey;
Policy employeePayCodeUpdatePolicy;
// 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 employee key
employeeKey = new EmployeeKey();
employeeKey.Id = "ACKE0001";
// Create a pay code key
payCodeKey = new PayCodeKey();
payCodeKey.Id = "COMM";
// Create an employee pay code key
employeePayCodeKey = new EmployeePayCodeKey();
employeePayCodeKey.EmployeeKey = employeeKey;
employeePayCodeKey.PayCodeKey = payCodeKey;
// Get the employee pay code object
employeePayCode = wsDynamicsGP.GetEmployeePayCodeByKey(employeePayCodeKey, context);
// Update the compensation period
employeePayCode.PayPeriod = CompensationPeriod.Quarterly;
// Get the update policy for employee pay code objects
employeePayCodeUpdatePolicy = wsDynamicsGP.GetPolicyByOperation(
"UpdateEmployeePayCode", context);
// Update the employee pay code object
wsDynamicsGP.UpdateEmployeePayCode(employeePayCode, context, employeePayCodeUpdatePolicy);
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}
** Legacy endpoint**
** Native endpoint **