ERPNext - Customer Update
This document describes the process of updating customers from ERPNext to App4Sales. The connector retrieves customer data, including their addresses and contacts, and maps it to the App4Sales customer model.
Data Source Configuration
The connector pulls data from the ERPNext API. The following DocTypes are used:
Customer
Contact
Address
Price List
Data Mapping Table
Customer
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
CustomerCode | Name | Direct mapping from the 'name' field. |
InternalCode | Name | Direct mapping from the 'name' field. |
CustomerName | customer_name | Direct mapping from the 'customer_name' field. |
ActionPriceList | default_price_list | The 'default_price_list' is used to find the corresponding App4Sales price list. The ID is constructed using the price list's 'idx' and 'currency'. |
Currency | default_currency | Direct mapping from the 'default_currency' field. |
CustomerClassification | customer_group | Direct mapping from the 'customer_group' field. |
Discount | discount | Direct mapping from the 'discount' field. |
email_id | Direct mapping from the 'email_id' field. | |
LanguageCode | language | Direct mapping from the 'language' field. |
Phone | phone_no | Direct mapping from the 'phone_no' field. |
UsesPriceField | default_price_list | The 'default_price_list' is used to find the corresponding App4Sales price list. The ID is constructed using the price list's 'idx' and 'currency'. If not found, it defaults to 0. |
Territory | territory | Stored in the 'DynamicFreeFieldList' with the key 'Territory'. |
Addresses
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
AddressLine1 | address_line1 | Direct mapping from the 'address_line1' field. |
AddressLine2 | address_line2 | Direct mapping from the 'address_line2' field. |
AddressLine3 | address_line_3 | Direct mapping from the 'address_line_3' field. |
City | city | Direct mapping from the 'city' field. |
Country | country | Direct mapping from the 'country' field. |
email_id | Direct mapping from the 'email_id' field. | |
Phone | phone | Direct mapping from the 'phone' field. |
PostCode | pincode | Direct mapping from the 'pincode' field. |
State | state | Direct mapping from the 'state' field. |
AddressId | name | Direct mapping from the 'name' field. |
AddressType | address_type | The 'address_type' is converted to App4Sales address types. 'Billing' becomes 'Invoice', 'Shipping' becomes 'Delivery', and all other types become 'Visit'. |
IsMainAddress | is_primary_address | Mapped to true if 'is_primary_address' is 1. |
Contact Persons
App4Sales Field | Source Field (API/Excel/DB) | Logic/Notes |
FirstName | first_name | Direct mapping from the 'first_name' field. |
LastName | last_name | Direct mapping from the 'last_name' field. |
FullName | name | Direct mapping from the 'name' field. |
email_id | Direct mapping from the 'email_id' field. | |
IsMainContactPerson | is_primary_contact | Mapped to true if 'is_primary_contact' is 1. |
Phonenumber | phone | Direct mapping from the 'phone' field. |
Special Logic & Filters
The connector links contacts and addresses to customers in the following ways:
Primary Contact/Address: The fields 'customer_primary_contact' and 'customer_primary_address' on the customer record are used to link the main contact and address.
Linked Contacts/Addresses: If the settings 'UseContactNameAsLinkToCustomer' or 'UseAddressNameAsLinkToCustomer' are enabled, the connector will link contacts and addresses to customers if the contact's FullName or address's Name starts with the customer's Name. For example, a contact with FullName 'CUST001-John' will be linked to customer 'CUST001'.
Related Settings & Prerequisites
Setting | Description |
UseContactNameAsLinkToCustomer | When enabled, the system links contacts to customers by matching the start of the contact's name with the customer's name. |
UseAddressNameAsLinkToCustomer | If this setting is active, addresses are associated with customers if the address name begins with the customer's name. |