When your website has forms, like those for downloading a whitepaper, or when your contacts are synced from Zoho Desk, it's possible to end up with orphaned contacts in your CRM. These orphaned contacts can make it harder to track interactions and get a complete view of the customer, which could lead to missed business opportunities. What if there were a quick workaround that automatically creates an account for such contacts and associates them together? A custom function helps you do so whenever a lead gets created in your CRM account.
Since this requirement is unique to only a few businesses, we offer a low-code solution that you can use to connect to workflow rules. Our solution creates an account with the contact's name, phone number, email, address, and region, streamlining the process of managing customer information. Read on to learn more.
Permissions and availability
- Users with the Manage Automation permission can create and update workflow rules.
- Users with the Manage Extensibility permission can create custom functions.
- Users with the Manage Sandbox permission can manage the sandbox.
Requirements
- Create a workflow rule for the Contacts module that will trigger a custom function every time a contact is created. Learn more
- Write a custom Deluge function that automatically creates and associates accounts for contact records. Learn more
- Test the workflow rule in a sandbox before deploying it in your production environment. Learn more
Create a workflow rule
Follow the steps below to create a workflow rule that updates the status of leads:
- Navigate to Setup > Workflow Rules > +Create Rule.
- Select the Module as Contacts from the dropdown list.
- Provide a name for the rule. For example: "Create accounts for contacts".
- Add a description (optional) and then click Next.
- In the Execute this workflow rule based on section, choose Record Action, then select Create from the dropdown and click Next.
- In the Which contacts would you like to apply the rule to? section, select All Contacts and click Next.
- Under Instant Actions, select Function and Write your own.
- Provide a name for the function, as well as a description, if necessary.
- In the Deluge Script Editor, do the following:
- Copy and paste the code given below.
- Click Edit Arguments.
- Choose Contacts - Contact Id, name it contId, and click Save.
- Click Save & Execute Script.
- Click Save on the workflow rule page.
The code
contDetails = zoho.crm.getRecordById("Contacts", contId.toLong());
//info contDetails;
mp=map();
mp.put("Owner",ifnull(contDetails.get("Owner"),"").get("id"));
mp.put("Account_Name",ifnull(contDetails.get("Full_Name"),""));
mp.put("Email",ifnull(contDetails.get("Email"),""));
mp.put("Phone",ifnull(contDetails.get("Phone"),""));
mp.put("Billing_Street",ifnull(contDetails.get("Mailing_Street"),""));
mp.put("Billing_City",ifnull(contDetails.get("Mailing_City"),""));
mp.put("Billing_State",ifnull(contDetails.get("Mailing_State"),""));
mp.put("Billing_Code",ifnull(contDetails.get("Mailing_Zip"),""));
mp.put("Billing_Country",ifnull(contDetails.get("Mailing_Country"),""));
mp.put("Region",ifnull(contDetails.get("Region"),""));
create = zoho.crm.createRecord("Accounts", mp);
info mp;
info create;
up=zoho.crm.updateRecord("Contacts", contId,{"Account_Name":create.get("id")});
info up;
Notes
- Make sure to use the accurate API names for their corresponding fields (e.g., "Email") in the code snippet. Learn more
- You can modify the code snippet to add or remove fields, including custom fields like "Region," to transfer their information from the contact to its account.
Tips
- Set the contact fields, after which its account is to be created, as unique to avoid creating duplicate account records.
- Configure and test the function in a sandbox to ensure that further development doesn't disrupt your production environment.
Test the solution
- Navigate to Contacts > + Create Contact.
- On the Create Contact page, fill in the fields for name, phone number, email, and region, then click Save.
The workflow rule will be triggered. - Check whether an account was created and associated with the contact using the above field information.
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 PointWorkflow Rule
- 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