Transferring contacts owned by your salespeople when they leave their jobs is crucial to ensure business continuity. This helps to keep critical client information up to date and prevents any disruptions in the relationship. The transfer of contacts also ensures a seamless transition for team members and consistent customer service. Assigning contact ownership to their respective account owners is a standard business practice that can enhance efficiency, reduce confusion, and increase sales opportunities. Nonetheless, transferring hundreds or thousands of contacts can be a challenging task. This is where a custom function can come in handy.
All you need to do is write a custom function that transfers contacts from their current owner to their account owner in bulk. This function can then be connected to a scheduler that updates up to 2,000 records at a time. Read on to learn more.
Permissions and availability
- Users with the Manage Automation permission can create and update schedules.
- Users with the Manage Extensibility permission can write custom functions.
- Users with the Manage Sandbox permission can manage the sandbox.
Requirements
- Create a new schedule that executes on a specified date and time. Learn more
- Write a custom Deluge function to transfer contacts from their current owner to their account owner and link it to the schedule. Learn more
- Test the function in a sandbox environment before deploying it to your production environment. Learn more
Create a schedule
Follow the steps below to create a new schedule in your Zoho CRM account:
- Navigate to Setup > Automation > Schedules > Create New Schedule.
- Provide a name for the schedule. For example: "Transfer Contact Ownership".
- Click Add Description and enter a description if necessary.
- In the Function to be executed field, choose Writing Function.
- In the Create New Function window, do the following:
- Provide a name, display name, and description, if necessary, for the function.
- Select Deluge as the Language, then click Create.
- On the Deluge Script Editor, do the following:
- Copy and paste the code given below.
- Click Save.
- Choose an Execution Start Date and time the function should be executed.
- Choose the schedule frequency as Once in the Frequency field.
- Click Save on the schedule page.
The code
loop = {1,2,3,4,5,6,7,8,9,10};
for each ele in loop
{
resp = zoho.crm.getRecords("Contacts",ele);
for each rec in resp
{
owner = ifnull(rec.get("Owner"),"").get("id");
info "owner:" + owner;
if(owner = 1234567890)
{
acc = ifnull(rec.get("Account_Name"),"");
info "a:" + acc;
if(acc != "")
{
accID = acc.get("id");
accOwner = zoho.crm.getRecordById("Accounts",accID).get("Owner").get("id");
mp = Map();
mp.put("Owner",accOwner);
upd = zoho.crm.updateRecord("Contacts",rec.get("id"),mp);
}
}
}
}
Notes
- Replace "1234567890" with the User ID of the contact's owner (salesperson) whose records must be transferred. You can find the user ID on the Setup page of your CRM.
- Make sure to use the accurate API names for their corresponding fields in the code snippet. Learn more
Tip
- Configure and test the function in a sandbox to ensure that further development doesn't disrupt your production environment.
Test the solution
- Once the schedule has been executed, open the contact you wish to transfer ownership of.
- Check whether its Contact Owner field was updated with the name of its corresponding account owner.
Idea
When you need to update the owner of invoices with the account owner, use the below code snippet with automation or a schedule. However, you must specify the user ID of the account's owner in the code.
mp = Map();
mp.put("Owner",acctownerId);
update = zoho.crm.updateRecord("Invoices",invoiceId,mp);
info mp;
info update;
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
- ModuleContacts
- Trigger PointSchedule
- 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