For Zoho services only


I'm currently part of a wider delivery team at Ascent Business Solutions, recognised as a leading Zoho Premium Solutions Partner in the United Kingdom.

Ascent Business Solutions support organisations with everything from targeted technical fixes through to full Zoho CRM implementations and long-term platform adoption. Working as a team rather than a one-person consultancy allows projects to move forward consistently, with access to the right skills at each stage.

The team I manage specialises in API integrations between Zoho and third-party finance and commerce platforms such as Xero, Shopify, WooCommerce, and eBay. Much of our work involves solving integration challenges that fall outside standard documentation, supporting new ideas, new sectors, and evolving business models.

Success is measured through practical outcomes and return on investment, ranging from scaling small operations into high-turnover businesses to delivering rapid gains through online payments, automation, and streamlined digital workflows.

If you are looking for structured Zoho expertise backed by an established consultancy, you can contact Ascent Business Solutions on 0121 392 8140 (UK), email info@ascentbusiness.co.uk, or visit https://www.ascentbusiness.co.uk.

Zoho CRM: Mapping a Multi-User or Multi-Lookup field using Deluge

What?
This is a very quick article with examples of managing a multi-user or multi-lookup field in CRM using Zoho Deluge.

Why?
Sometimes you might need this when data mapping fields from one module to another, sometimes you need to manage existing multi-lookups/users in a record.

How?
So the key point to remember is that all multi-select lookup and multi-user lookup fields are held in temporary CRM modules called a "LinkingModule" (as opposed to standard modules and custom modules).

Quick way to determine the API name of the linking module:
  1. Go to setup > Developer Space > functions.
  2. Create a standalone function called "Test".
  3. Type in line 1: r_Record = zoho.crm.getRecords
  4. then press Enter (DO NOT START TYPING FOR A MODULE NAME - LET THE SYSTEM POPUP YOUR OPTIONS AS PER THE FOLLOWING SCREENSHOT - USE ARROW KEYS OR MOUSE): Zoho Deluge - Mapping a Multi-Lookup - Quick Select
As you can see from the screenshot above, there are modules concatenated with one module an "X" and then the name of the linked module. A module called "Opportunities_X_Products" is likely to be a linking module which has a multi-select lookup on both the deal/opportunity and products module. A multi-user lookup will tend to have something like "ModuleName_X_Users".

Find records relevant to this module:
copyraw
l_LinkedRecords = zoho.crm.searchRecords("Opportunities_X_Products","(Opportunity:equals:" + v_DealID + ")");
  1.  l_LinkedRecords = zoho.crm.searchRecords("Opportunities_X_Products","(Opportunity:equals:" + v_DealID + ")")

Find records relevant to this user:
copyraw
v_SearchCriteria = "(field0:equals:" + v_UserID + ")";
l_SearchResults = zoho.crm.searchRecords("Vendors_X_Users",v_SearchCriteria);
  1.  v_SearchCriteria = "(field0:equals:" + v_UserID + ")"
  2.  l_SearchResults = zoho.crm.searchRecords("Vendors_X_Users",v_SearchCriteria)

Code to Add a value to a multi-lookup (on Create Record):
copyraw
// sample code when creating a record in a module that contains a lookup
m_Create = Map();
m_Create.put("Name","Joels Amazing Test");
r_Create = zoho.crm.createRecord("Tests", m_Create);

// now take the ID that was created and use the following code to populate the multi-lookup field
if(!isnull(r_Create.get("id")))
{
    m_Link = Map();

    // using record IDs cos there's nothing better
    m_Link.put("Test",r_Create.get("id"));

    // using record IDs cos there's nothing better
    m_Link.put("Joel",123456789012345678);

    // create link
    r_Link = zoho.crm.createRecord("Tests_X_Contacts", m_Link);
}
  1.  // sample code when creating a record in a module that contains a lookup 
  2.  m_Create = Map()
  3.  m_Create.put("Name","Joels Amazing Test")
  4.  r_Create = zoho.crm.createRecord("Tests", m_Create)
  5.   
  6.  // now take the ID that was created and use the following code to populate the multi-lookup field 
  7.  if(!isnull(r_Create.get("id"))) 
  8.  { 
  9.      m_Link = Map()
  10.   
  11.      // using record IDs cos there's nothing better 
  12.      m_Link.put("Test",r_Create.get("id"))
  13.   
  14.      // using record IDs cos there's nothing better 
  15.      m_Link.put("Joel",123456789012345678)
  16.   
  17.      // create link 
  18.      r_Link = zoho.crm.createRecord("Tests_X_Contacts", m_Link)
  19.  } 

Code to Add a value to a multi-lookup (on Update Record):
copyraw
v_DealID = ifnull(input.p_DealID,0);
if(v_DealID != 0)
{
    m_Link = Map();
    m_Link.put("Deal", v_DealID);
    m_Link.put("Product", 123456789012345678);
    r_Link = zoho.crm.createRecord("Deals_X_Products", m_Link);
}
  1.  v_DealID = ifnull(input.p_DealID,0)
  2.  if(v_DealID != 0) 
  3.  { 
  4.      m_Link = Map()
  5.      m_Link.put("Deal", v_DealID)
  6.      m_Link.put("Product", 123456789012345678)
  7.      r_Link = zoho.crm.createRecord("Deals_X_Products", m_Link)
  8.  } 

Code to Delete a value from a multi-lookup:
copyraw
v_ID2Delete = 123456789012345678;
v_SearchCriteria = "(field0:equals:" + v_myRecordID + ")";
l_SearchResults = zoho.crm.searchRecords("Tests_X_Users",v_SearchCriteria);
for each  r_Link in l_SearchResults
{
    if(!isnull(r_Link.get("id")) && r_Link.get("Test").get("id")==v_ID2Delete)
    {
        m_Delete = Map();
        m_Delete.put("module","Tests_X_Users");
        m_Delete.put("id",r_Link.get("id"));
        r_Delete = zoho.crm.invokeConnector("crm.delete", m_Delete);
    }
}
  1.  v_ID2Delete = 123456789012345678
  2.  v_SearchCriteria = "(field0:equals:" + v_myRecordID + ")"
  3.  l_SearchResults = zoho.crm.searchRecords("Tests_X_Users",v_SearchCriteria)
  4.  for each  r_Link in l_SearchResults 
  5.  { 
  6.      if(!isnull(r_Link.get("id")) && r_Link.get("Test").get("id")==v_ID2Delete) 
  7.      { 
  8.          m_Delete = Map()
  9.          m_Delete.put("module","Tests_X_Users")
  10.          m_Delete.put("id",r_Link.get("id"))
  11.          r_Delete = zoho.crm.invokeConnector("crm.delete", m_Delete)
  12.      } 
  13.  } 



Update 2025
Having to do this again in 2025 and things seem to have changed. I've added a multi-user lookup on the quotes record called "Requires_Approval_Users". A quick setup method is now to use the CRM interface to add a couple of users to the field and then save the changes. I now query all the records held so far in this linking module which I'm guessing is called Quotes_X_Users (would appear in the popup once you start typing zoho.crm.getRecords. I'll get an array back of 2 records and I'll be looking for the 2 lookup fields (contains an ID and name) per record. In my case:
copyraw
..
"Requires_Approval_Users":{
     "name":"Joel Lipman",
     "id":"12345600000987654"
},
...

AND

..
"userlookup221_2":{
     "name":"Another Joel",
     "id":"12345600000987653"
},
...
  1.  .. 
  2.  "Requires_Approval_Users":{ 
  3.       "name":"Joel Lipman", 
  4.       "id":"12345600000987654" 
  5.  }, 
  6.  ... 
  7.   
  8.  AND 
  9.   
  10.  .. 
  11.  "userlookup221_2":{ 
  12.       "name":"Another Joel", 
  13.       "id":"12345600000987653" 
  14.  }, 
  15.  ... 
So I'll just refer to https://www.zoho.com/crm/developer/docs/api/v8/insert-records.html and here's the code to associate 1 user in the multi-user lookup:
copyraw
m_AssociateMultiUserLookup = {"data":[{"id":p_QuoteID, "Requires_Approval_Users":[{"Requires_Approval_Users":{"id":m_ApprovalUser.get("id")}}]}]};
r_AssociateMultiUserLookup = invokeurl
[
	url: "https://www.zohoapis.eu/crm/v8/Quotes"
	type: PUT
	parameters: m_AssociateMultiUserLookup.toString()
	connection: "my_crm_connection"
];			
info "Response from associating user " + _ApprovalUser.get("id");
info r_AssociateMultiUserLookup;
  1.  m_AssociateMultiUserLookup = {"data":[{"id":p_QuoteID, "Requires_Approval_Users":[{"Requires_Approval_Users":{"id":m_ApprovalUser.get("id")}}]}]}
  2.  r_AssociateMultiUserLookup = invokeurl 
  3.  [ 
  4.      url: "https://www.zohoapis.eu/crm/v8/Quotes" 
  5.      type: PUT 
  6.      parameters: m_AssociateMultiUserLookup.toString() 
  7.      connection: "my_crm_connection" 
  8.  ]
  9.  info "Response from associating user " + _ApprovalUser.get("id")
  10.  info r_AssociateMultiUserLookup; 
Another method to check for API names is to query the metadata in the linking module:
copyraw
//
// used for checking api names and the linking module (not visible via the interface)
v_Endpoint = "https://www.zohoapis.com/crm/v8/settings/fields?module=Quotes_X_Users";
r_MetaData = invokeurl
[
	url: v_Endpoint2
	type: GET
	connection:"my_crm_connection"
];
info r_MetaData;
//
// I can see 2 api names for lookups
// userlookup221_2
// Requires_Approval_Users
  1.  // 
  2.  // used for checking api names and the linking module (not visible via the interface) 
  3.  v_Endpoint = "https://www.zohoapis.com/crm/v8/settings/fields?module=Quotes_X_Users"
  4.  r_MetaData = invokeurl 
  5.  [ 
  6.      url: v_Endpoint2 
  7.      type: GET 
  8.      connection:"my_crm_connection" 
  9.  ]
  10.  info r_MetaData; 
  11.  // 
  12.  // I can see 2 api names for lookups 
  13.  // userlookup221_2 
  14.  // Requires_Approval_Users 
My full snippet of code
copyraw
//
	// loop through users to find the approver
	for each  m_User in l_Users
	{
		if(m_User.get("Job_Title").equalsIgnoreCase("CFO"))
		{
			l_ApprovalUsers.add(m_User.get("id"));
		}
	}
	//
	// check list of IDs
	if(l_ApprovalUsers.size() > 0)
	{
		//
		// reset multi-user lookup field (clear out values)
		v_SearchCriteria = "(userlookup221_2:equals:" + p_QuoteID + ")";
		l_SearchResults = zoho.crm.searchRecords("Quotes_X_Users",v_SearchCriteria);
		info l_SearchResults;
		for each  m_DeleteResult in l_SearchResults
		{
			if(!isNull(m_DeleteResult.get("id")))
			{
				m_Delete = Map();
				m_Delete.put("module","Quotes_X_Users");
				m_Delete.put("id",m_DeleteResult.get("id"));
				r_Delete = zoho.crm.invokeConnector("crm.delete",m_Delete);
				info "Deleted record " + m_DeleteResult.get("id");
			}
		}
		//
		// update linking module
		for each  v_ApprovalUserID in l_ApprovalUsers
		{
			m_AssociateMultiUserLookup = {"data":{{"id":p_QuoteID,"Requires_Approval_Users":{{"Requires_Approval_Users":{"id":v_ApprovalUserID}}}}}};
			r_AssociateMultiUserLookup = invokeurl
			[
				url :"https://www.zohoapis.com/crm/v8/Quotes"
				type :PUT
				parameters:m_AssociateMultiUserLookup.toString()
				connection:"my_crm_connection"
			];
			info "Response from associating user " + v_ApprovalUserID;
			info r_AssociateMultiUserLookup;
		}
	}
  1.  // 
  2.      // loop through users to find the approver 
  3.      for each  m_User in l_Users 
  4.      { 
  5.          if(m_User.get("Job_Title").equalsIgnoreCase("CFO")) 
  6.          { 
  7.              l_ApprovalUsers.add(m_User.get("id"))
  8.          } 
  9.      } 
  10.      // 
  11.      // check list of IDs 
  12.      if(l_ApprovalUsers.size() > 0) 
  13.      { 
  14.          // 
  15.          // reset multi-user lookup field (clear out values) 
  16.          v_SearchCriteria = "(userlookup221_2:equals:" + p_QuoteID + ")"
  17.          l_SearchResults = zoho.crm.searchRecords("Quotes_X_Users",v_SearchCriteria)
  18.          info l_SearchResults; 
  19.          for each  m_DeleteResult in l_SearchResults 
  20.          { 
  21.              if(!isNull(m_DeleteResult.get("id"))) 
  22.              { 
  23.                  m_Delete = Map()
  24.                  m_Delete.put("module","Quotes_X_Users")
  25.                  m_Delete.put("id",m_DeleteResult.get("id"))
  26.                  r_Delete = zoho.crm.invokeConnector("crm.delete",m_Delete)
  27.                  info "Deleted record " + m_DeleteResult.get("id")
  28.              } 
  29.          } 
  30.          // 
  31.          // update linking module 
  32.          for each  v_ApprovalUserID in l_ApprovalUsers 
  33.          { 
  34.              m_AssociateMultiUserLookup = {"data":{{"id":p_QuoteID,"Requires_Approval_Users":{{"Requires_Approval_Users":{"id":v_ApprovalUserID}}}}}}
  35.              r_AssociateMultiUserLookup = invokeurl 
  36.              [ 
  37.                  url :"https://www.zohoapis.com/crm/v8/Quotes" 
  38.                  type :PUT 
  39.                  parameters:m_AssociateMultiUserLookup.toString() 
  40.                  connection:"my_crm_connection" 
  41.              ]
  42.              info "Response from associating user " + v_ApprovalUserID; 
  43.              info r_AssociateMultiUserLookup; 
  44.          } 
  45.      } 
Category: Zoho CRM :: Article: 280

Credit where Credit is Due:


Feel free to copy, redistribute and share this information. All that we ask is that you attribute credit and possibly even a link back to this website as it really helps in our search engine rankings.

Disclaimer: Please note that the information provided on this website is intended for informational purposes only and does not represent a warranty. The opinions expressed are those of the author only. We recommend testing any solutions in a development environment before implementing them in production. The articles are based on our good faith efforts and were current at the time of writing, reflecting our practical experience in a commercial setting.

Thank you for visiting and, as always, we hope this website was of some use to you!

Kind Regards,

Joel Lipman
www.joellipman.com