When employees leave an organization, their CRM records are typically reassigned to other team members. However, in organizations that use both Zoho CRM and Zoho Books for managing customer relationships and financial operations, this ownership transfer doesn't automatically update in Zoho Books. Consequently, the previous user continues to be listed as the salesperson on invoices, sales orders, and estimates.
This ownership mismatch creates a critical access issue. New account owners, even though they're responsible for the accounts in CRM, cannot view related financial transactions in the Zoho Finance tab within the CRM interface. The problem becomes more pronounced when new owners are assigned the Integration User role in Zoho CRM, as this role limits direct access to Zoho Books. As a result, sales teams lose visibility into essential customer financial data, which hurts their ability to manage relationships effectively.
Manually updating ownership in organizations with thousands of affected records is not a practical solution. Additionally, the 200-record limit per bulk update in Zoho Books further complicates the update process. Common workarounds include changing the Data Sharing setting to Public in Zoho CRM, granting administrative privileges to sales reps, or removing the "Assigned Customers Only" restriction in Zoho Books. Although these workarounds may provide temporary relief, they come with significant security and data privacy risks that many businesses handling sensitive customer information find unacceptable. This is where our low-code automation tools provide a practical and secure alternative.
By automating the synchronization of salesperson information between CRM account ownership and Zoho Books transaction records, this solution ensures consistent access to financial data during personnel transitions. All you need to do is create custom functions for invoices, sales orders, and estimates and link each to a workflow rule that triggers when the corresponding record is created or edited. Read on to learn more.
Permissions and availability
- Access to Zoho CRM Enterprise, Professional, or Ultimate edition or Zoho One.
- Access to any paid plan in Zoho Books.
- Administrative privileges in Zoho Books to create workflow rules, connections, and custom functions.
Prerequisites
- Enable the Zoho Finance Suite integration in Zoho CRM. Learn more
- Sync the contacts between CRM and Books.
- Add new record owners in Zoho CRM as active Salespersons in Zoho Books.
Requirements
- Create a Zoho Books connection with the required scope as detailed in the "Create a connection" section below. Learn more
- Write a custom Deluge function to be linked up with the workflow rule. Learn more
- Create a workflow rule for the Invoice module in Zoho Books that triggers the custom function whenever an invoice is created or updated. Learn more
Create a connection
The first step is to create a connection in your Zoho Books account.
- Navigate to Settings > Developer Data > Connections.
- Click New Connection.
- Select Zoho Books under Default Services.
- Specify a Connection Name.
You will enter this name in the code snippet below. - Select the following Scope to request access:
- ZohoBooks.fullaccess.all
- Click Create and Connect.
- Click Connect, then click Accept to confirm access authorization for the requested scope.
Write a custom function
Next, create a custom function in your Zoho Books account.
- Navigate to Settings > Workflow Actions > Custom Functions > + New
- Provide a name and description for the function. For example: "Sync salesperson from CRM"
- Select the module for the function as Invoice.
- In the Deluge Script Editor, copy and paste the code provided below.
- Click Save.
Create a workflow rule
Next, create a workflow rule in Zoho Books and link it to the custom function.
- Navigate to Settings > Automation > Workflow Rules > + New Workflow Rule.
- In the New Workflow Rule pop-up, do the following:
- Enter a name for the workflow rule.
- Add a description if necessary.
- Select Invoice from the module dropdown list.
- Choose All Invoice Types under the Execute Workflow For? option.
- Click Next.
- In the Workflow Rule Execution Condition section, do the following:
- Choose Event Based as the workflow type.
- Select Created or Edited as the action type.
- Choose Any field is updated as the workflow trigger.
- Select Edited each time for the execution option.
- Click Next.
- Click + New Criteria to create new criteria for the workflow rule.
- In the right sidebar, click No to skip, then click Done.
- Click Immediate Actions and select Custom Functions as the action type.
- From the Name dropdown, choose the name of the custom function you configured.
- Click Associate to finish associating actions with the criteria.
- Click Save to save the workflow rule.
The code
invoiceID = invoice.get("invoice_id");
organizationID = organization.get("organization_id");
customerID = invoice.getJson("customer_id");
getContact = invokeurl
[
url :"https://www.zohoapis.com/books/v3/contacts/" + customerID + "?organization_id=" + organizationID + ""
type :GET
connection:"connectionname"
];
contact = getContact.getJson("contact");
if(contact.getJson("is_crm_customer") == True)
{
crmAccountId = contact.getJson("zcrm_account_id");
info "crmAccountId >> " + crmAccountId;
getAccount = zoho.crm.getRecordById("Accounts",crmAccountId);
ownerId = getAccount.getJson("Owner").getJson("id");
getUsers = zoho.crm.getRecords("users").getJson("users");
for each user in getUsers
{
if(user.getJson("id") == ownerId)
{
userEmail = user.getJson("email");
info "userEmail >> " + userEmail;
break;
}
}
if(userEmail.isNull() != True)
{
getSalesPerson = invokeurl
[
url :"https://www.zohoapis.com/books/v3/salespersons?organization_id=" + organizationID + ""
type :GET
connection:"connectionname"
];
data = getSalesPerson.getJson("data");
for each salesPerson in data
{
if(salesPerson.getJson("salesperson_email") == userEmail)
{
salesPersonId = salesPerson.getJson("salesperson_id");
info "salesPersonId >> " + salesPersonId;
break;
}
}
if(salesPersonId.isNull() != True)
{
mp = Map();
mp.put("salesperson_id",salesPersonId);
updateSalesOrder = invokeurl
[
url :"https://www.zohoapis.com/books/v3/invoices/" + invoiceID + "?organization_id=" + organizationID + ""
type :PUT
parameters:mp.toString()
connection:"connectionname"
];
info "updateSalesOrder >> " + updateSalesOrder;
}
}
}Notes
- Make sure to use accurate API names for their corresponding fields (e.g., "Owner") in the code snippet. Learn more
- Replace "connectionname" with the name of the connection you specified when creating it in Zoho Books (see the "Create a connection" section above).
- Change the URL endpoint to match the data center of your account. For example, https://www.zohoapis.in/... for India.
- The code above is an example of automatically updating salespersons in Zoho Books invoices when account ownership changes in Zoho CRM. You can adapt this code for other modules, such as Sales Orders and Estimates, by modifying the module name.
Test the solution
- Log in to Zoho CRM and navigate to the Accounts module.
- Open a specific account record that has one or more associated invoice transactions in Zoho Books.
- Document the Account Name and Account Owner in Zoho CRM. Also, open the corresponding invoice in Zoho Books and record the current salesperson shown on that invoice.
- Confirm that the salesperson on this invoice is the old user and does not match the current CRM account owner.
- Edit and save the invoice to trigger the workflow rule containing the custom function.
- Check whether the salesperson field on the invoice now reflects the new Account Owner from Zoho CRM.
- Return to the Account record in Zoho CRM and verify that the invoice is now visible under the Zoho Finance tab for the new Account Owner, confirming the salesperson transfer is complete.
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
- ModuleFinance Suite
- Trigger PointWorkflow Rule
- EditionEnterprise and above
- ComplexityMedium
- Implementation Time30 minutes

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