Some businesses consider the customer's account address as the primary business location. For others, the account might have specific billing or shipping preferences, so they use its address. In such cases, businesses prefer to create a sales order using the address details from an account record instead of the contact address. However, when you create a sales order in your CRM, the contact address is automatically populated upon selecting a contact, even overwriting any manually entered information in its address field. This standard behavior can frustrate salespeople entering orders, leading to additional work and redundant data entry. However, this doesn't need to be the case anymore!
Since this requirement is unique to a small number of businesses, we support it through our low-code tools. You can write a client script to smoothly execute these automations on your browsers whenever you save a sales order. This script can update the account address as needed. Read on to learn more.
Permissions and availability
- Users with the Manage Extensibility permission can create client scripts.
- Users with the Manage Sandbox permission can manage the sandbox.
Requirements
- Create a client script that triggers when the sales orders module page is saved. Learn more
- Test the function in a sandbox environment before deploying it to your production environment. Learn more
Create a client script
Follow the steps below to create a client script in your Zoho CRM account:
- Navigate to Setup > Developer Hub > Client Script > +New Script.
- Provide a name for the script. For example: "Update address on sales orders".
- Add a description (optional).
- In the Page Details section, do the following:
- Category - Choose Module.
- Page - Choose Create Page.
- Module - Choose Sales Orders.
- Choose the layout. It can be Standard or any other custom layout of the sales orders module.
- In the Event Details section, do the following:
- Type - Choose Page Event
- Event - Choose onSave.
- Click Next.
The Client Script IDE will open. - Copy and paste the script provided below.
You can customize the script, if needed. - Click Save and Close to save the client script.
The code
var account = ZDK.Page.getField('Account_Name').getValue();
if(account!=null)
{
var account_id = account.id;
var accountDetails = ZDK.Apps.CRM.Accounts.fetchById(account_id);
var streeDetails = accountDetails.Billing_Street;
var cityDetails = accountDetails.Billing_City;
var stateDetails = accountDetails.Billing_State;
var codeDetails = accountDetails.Billing_Code;
var countryDetails = accountDetails.Billing_Country;
ZDK.Page.getField('Billing_Street').setValue(streetDetails);
ZDK.Page.getField('Billing_City').setValue(cityDetails);
ZDK.Page.getField('Billing_Code').setValue(codeDetails);
ZDK.Page.getField('Billing_State').setValue(stateDetails);
ZDK.Page.getField('Billing_Country').setValue(countryDetails);
}
Notes
- Make sure you update the script with the accurate API name of their corresponding fields. Learn more
- The above script is an example of updating the account address in the Sales Orders module. You can use this script for any other module by changing the field name and parameters.
Tip
- Configure and test the function in a sandbox to ensure that further development doesn't disrupt your production environment.
Test the solution
- Go to Sales Orders > +Create Sales Order.
- Enter the sales order information, associate a contact and account, and include other relevant information.
Note: The contact's address will be updated as the sales order's address, which can be ignored. - Click Save.
The workflow rule will be triggered. - Check whether the sales order address was updated with the account address instead of the contact address.
Did you find this useful? Try it out and let us know how it works. Share this with your team if they'd benefit from it! If you have questions, please don't hesitate to contact us.
More info
- ModuleSales Orders
- Trigger PointBrowser
- EditionEnterprise and above
- ComplexityLow
- Implementation Time15 minutes

Looking for a custom solution?
Contact us, we will help enhance your productivity at lightning speed.
SUBMIT REQUEST