Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Description
Updates the specified employee address object, storing the current values in the database.
Parameters
Parameter |
Type |
Description |
---|---|---|
employee |
The employee address 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. |
Interfaces
- Dynamics GP
- Human Resources/Payroll
Examples
The following C# example retrieves and updates the employee address with the employee with an Id of "ACKE0001" and a employee address Id of "Test address". The update sets the State property to "WA". The UpdateEmployeeAddress operation saves the updated address value 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; EmployeeKey employeeKey; EmployeeAddressKey employeeAddressKey; EmployeeAddress employeeAddress; Policy employeeAddressUpdatePolicy; // 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 employee key employeeKey = new EmployeeKey(); employeeKey.Id = "ACKE0001"; // Create an employee address key employeeAddressKey = new EmployeeAddressKey(); employeeAddressKey.EmployeeKey = employeeKey; employeeAddressKey.Id = "Test address"; // Get the specified employee address object employeeAddress = wsDynamicsGP.GetEmployeeAddressByKey(employeeAddressKey, context); // Change the value of the State property of the employee address object employeeAddress.State = "WA"; // Get the update policy for employee address objects employeeAddressUpdatePolicy = wsDynamicsGP.GetPolicyByOperation("UpdateEmployeeAddress", context); // Update the employee address object wsDynamicsGP.UpdateEmployeeAddress(employeeAddress, context, employeeAddressUpdatePolicy); } } }
** 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; EmployeeKey employeeKey; EmployeeAddressKey employeeAddressKey; EmployeeAddress employeeAddress; Policy employeeAddressUpdatePolicy; // 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 employee key employeeKey = new EmployeeKey(); employeeKey.Id = "ACKE0001"; // Create an employee address key employeeAddressKey = new EmployeeAddressKey(); employeeAddressKey.EmployeeKey = employeeKey; employeeAddressKey.Id = "Test address"; // Get the specified employee address object employeeAddress = wsDynamicsGP.GetEmployeeAddressByKey(employeeAddressKey, context); // Change the value of the State property of the employee address object employeeAddress.State = "WA"; // Get the update policy for employee address objects employeeAddressUpdatePolicy = wsDynamicsGP.GetPolicyByOperation("UpdateEmployeeAddress", context); // Update the employee address object wsDynamicsGP.UpdateEmployeeAddress(employeeAddress, context, employeeAddressUpdatePolicy); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }