100%

Updating Multi-Select Lookup on Zoho CRM

Difficulty: Beginner
Estimated reading time: 10 mins
Estimated implementation time: 30 mins

Every Joe and Jane knows how to update lookup fields via Deluge. But when it comes to updating multi-select/user lookup fields, it can be tad bit more complicated than just sticking the “id” to the lookup field.

The "Linking Module"

To understand how this is done is to first understand the relationship between lookup modules. When a multi-select lookup is made between two modules (eg; Contacts & Deals), a Linking Module (Contacts_X_Deals) is created. This linking module stores information of both Contacts & Deals, allowing a many-to-many relationship to be established.

Finding the Linking Module

The linking module, unlike regular modules in CRM, is not visible from the front-end. The way to find it is to run an API call that gets ALL modules in CRM. This function reveals all modules in CRM (including hidden ones) and its respective fields.

CRM Connections needed for API Call:

  • scope=ZohoCRM.settings.all (or)
  • scope=ZohoCRM.settings.modules.{operation_type}

Once executed, you will be greeted with a long JSON text containing every single module details in your CRM account. Stick the text in to a JSON viewer and quickly sieve through the modules to find the Linking Module you need (tip: they usually look like “Module_A_X_Module_B”).

Once you’ve found the module, you should see two lookup fields that links two modules (A & B) respectively. Save the module name and lookup field API names into your notes, you will need it for later.

API Name Checklist (save for later)

  • Linking Module Name
  • Lookup field name to Module A
  • Lookup field name to Module B

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


Updating the Multi-Select/User Lookup Field

Now that you have what you need, in order to update the lookup field, you need to create a record in the linking module with the relevant record IDs from Module A & B placed in its respective lookup fields.

This is done by creating a map of to store the lookup fields and record IDs, which will be used to create the record in the linking module.

  • Replace “lookupfield_A” with the lookup field name to module A (eg; Contacts) and “A_record_ID” with the relevant record ID
  • Replace “lookupfield_B” with the lookup field name to module B (eg; Deals) and “B_record_ID” with the relevant record ID
  • Replace “Linking_Module_Name” with the linking module API name (they usually look like this: Contacts_X_Deals).

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

More Free Resources

Deluge Tips – Null Check

When scripting, ask yourself this question – will this value ever be null? If it’s a yes, that’s a place for a null check! Here are 3 tips and best practices to help you kickstart the habit....

Read More »

Comments

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