Create Customer Example

Create Customer 

Using the customer end point you can create a customer.      The only property that needs to populated is Name property which needs to be unique.    

Use the Entity Ref or List endpoints to return a list of matching customer names.   If results are empty you know the customer is unique.  If the list is not empty, then you can update the customer using its Id.     For example  say we want to search for a customer with the name 'IBM Corp'.  I would use the ListInfo object as follows

{
   "Type": 120,
   "Filters" : [ 
    {
        "PropertyName": "Name",
        "Operator": 1, 
        "FilterValueArray": "IBM Corp"
    }]
}

120 is the Customer Record Type enum.   Filters is an array of Filter Field which specifies the PropertName, the operation and the filter value.   The operator is also an enum representing 'equals to'   

In addition to the name and addresses that your would typically populate,  you may also want to additional properties such as Term (TermRef) or Ship Method (SalesTaxCodeRef).   In order to do this, you must supply the payload with an EntityRef.    You can easily get a list of entities refs for Terms using the Entity Ref or List end points.  For example this payload will get all active terms.

{
   "Type": 190,
   "Filters" : [ 
    {
        "PropertyName": "IsActive",
        "Operator": 1, 
        "FilterValueArray": "1"
    }]
}

Custom fields are an array of CustomFieldData.    It requires that you know the name of the custom field which you can obtain from the Order Time custom fields list.  

Special Cases

There are 2 properties that warrant special mention. 

Parent - The parent property is a used to create a hierarchy of customers and jobs.   For example if you want to create a Job under customer IBM Corp.  You would set the Name property as the Job # and the Parent property to IBM Corp.

ProxyRef - The proxy is used so that a customer is not synchronized with your Accounting system.  For example, say you have many individual customers that you would not want synchronize instead you use a place holder customer (proxy e.g. WebOrders) for all synchronized transactions.   In this case you would set the ProxyRef to EntityRef of WebOrders.