100%

Converting Non-Lead Records in Zoho CRM

Difficulty: Intermediate
Estimated reading time: 15 mins
Estimated implementation time: 1 hour

Cross-module record conversion can be mind-numbing if done manually, especially when you’re dealing with a list of records. Don’t you wish that you can convert records from any one module to another in Zoho CRM in a single click of a button like the “Convert” button in Leads? Well, we’ll show you how you can build one that even works for custom modules!

Some of you may think “I don’t need to know this cause I’ll never need to do record conversions”. Before you hit the back button, it might interest you to know that some parts of this article can be useful to you, like how to convert related lists, activities, move attachment, notes and more. While I still have you here, let’s dive in!

Cool Ideas to use the Code

Here are some cool ideas on ways you can use the code in Zoho CRM:

  • Convert a Record from ANY module to ANY module (including custom modules).
  • “Undo Convert” of Contacts (converting Contacts back to Leads). Click here to jump straight to that.
  • For Deduplication Activities: You can use this code to copy over fields, convert Related Tasks / Meetings / Calls, Move Attachments, Notes and other Related Lists to a record before deleting the duplicate.

Checklist & Configuration

Create New Record

Get the necessary fields of the record in the original module (oldModule), then create a record in the destination module (newModule) with a map containing the fields. Get the ID of the new record you have just created for later use. You now have the new record in the new module with all the fields you need copied over.

The Great Migration

A conversion is not complete without migrating the related lists.The common related lists on a record are Contacts, Deals, Notes and Activities (Tasks, Events, Calls). This may differ on a case-to-case basis depending on your modules, but here, we will focus on the four.

Related Contacts & Deals

We migrate related Contacts by getting all related Contacts on the old module. If the related Contact list is not empty, we iterate through each Contact, remove its connection from the old module, then link to the new.

The same is done for related Deals.

Want to learn even more? Sign up for one of our Zoho courses!


Related Notes

We don’t wanna lose any notes about how Joe’s favourite food is sushi now do we? When copying notes, we wanna make sure to copy both the Note Title and the Note Content. Then, we re-create the notes in the new record by sticking the new record ID in the “Parent_Id” and setting the “$se_module” to the new module.

Activities

Let’s not lose track of what we are in the midst of doing, going to do, or have already done in the past. “Activities” consists of Tasks, Events and Calls. All Open Activities (current & future) are stored in the “Activities” module. To migrate them to the new record, we need to update certain fields on the related activity records.

  • “$se_module” is updated with the new module
  • “What_Id” is updated with a map of the new record ID

Past activities are stored in another module called “Activities History”.

Attachments

Attachments can be migrated by first downloading them into the function, then uploading to the new record. For both download and upload functions, Zoho CRM API call is needed (that’s where your connection is needed).

Farewell Old Record

Once everything is fully migrated, it’s time to bid farewell to the old record with the delete record API call.

Click here to copy these scripts. For more Zoho-wizardry, check out our GitHub page.

Convert Contacts back to Leads

The ability to convert Contacts back to Leads is sought after by many. Since Zoho does not have that functionality yet, we’re gonna build it using the scripts above.

What happens during a Lead Conversion?

  • When a Lead is converted into a Contact, a few other things happen:
    An Account is created
  • A new Deal is created (optional) To undo a conversion, we need to reverse engineer the process.

In order to convert a Contact back to a Lead, here’s what we need the script to do:

  • Get all necessary fields and create the Lead record (make sure all mandatory fields are mapped).
  • Copy over all Related Notes
  • Reassign all related Activties (past and present)
    • “Who_Id” has to be set to “” to remove the connection with the Contact (this is necessary to prevent the activities from being deleted when the Contact is deleted later).
  • Copy over all Attachments (make sure that the attachments are moved to the Contact instead of Deals during the Zoho Lead conversion. If it was moved to the Deal, you will need to reconfigure the script).
  • Delete all Related Deals
  • Delete the Related Account
  • Delete the Contact Record

Create a Button for the Function

For best user experience, create a custom button that says “Undo Convert” on the “View Page” which will execute the script.

  • Add a note in the button description to warn users that the related Account and Deals will be deleted.
  • Add a success message with the URL of the Lead at the end of the script to notify users that the “Undo Conversion” is complete.

More Free Resources

Comments

Are we through here? Ok, go check out our other guides!