Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Description
Updates the specified customer object, storing the current values in the database.
Parameters
Parameter |
Type |
Description |
|---|---|---|
customer |
The customer 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
- Sales
Examples
The following C# example retrieves the customer with the key value "AARONFIT0001" and sets the Comment1 property. The UpdateCustomer operation saves the change.
** Legacy endpoint**
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
Customer customer;
CustomerKey customerKey;
Policy customerPolicy;
// 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 a customer key
customerKey = new CustomerKey();
customerKey.Id = "AARONFIT0001";
// Retrieve the customer object
customer = wsDynamicsGP.GetCustomerByKey(customerKey, context);
// Add a comment
customer.Comment1 = "Customer is moving";
// Get the update policy for the customer
customerPolicy = wsDynamicsGP.GetPolicyByOperation("UpdateCustomer", context);
// Update the customer
wsDynamicsGP.UpdateCustomer(customer, context, customerPolicy);
}
}
}
** Native endpoint **
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
Customer customer;
CustomerKey customerKey;
Policy customerPolicy;
// 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 a customer key
customerKey = new CustomerKey();
customerKey.Id = "AARONFIT0001";
// Retrieve the customer object
customer = wsDynamicsGP.GetCustomerByKey(customerKey, context);
// Add a comment
customer.Comment1 = "Customer is moving";
// Get the update policy for the customer
customerPolicy = wsDynamicsGP.GetPolicyByOperation("UpdateCustomer", context);
// Update the customer
wsDynamicsGP.UpdateCustomer(customer, context, customerPolicy);
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}