Get User Data

Get User Data

Table of Contentsup

This is used to get the information about the users in your Zoho CRM using invokeConnector() Deluge task.


m= map();
<CRM Response> = zoho.crm.invokeConnector("crm.getusers", m);

<CRM Response> is the map variable returned by CRM as response.
<m> is the map variable that holds the key,value pairs.


lead_id = input.lead.get("Leads.ID");
datamap = map();
datamap.put("module", "Leads");
datamap.put("id", lead_id);
resp = zoho.crm.invokeConnector(("crm.get"), datamap);
resp1 = (resp.get("response")).toMap();
res = resp1.get("data");
re = res.replaceAll("[","",true);
reqq = re.replaceAll("]","",false).toMap();
l_number = (reqq.get(("roundrobinleadassignment0.Lead_Number"))).toLong();
rule = reqq.get(("roundrobinleadassignment0.Assign_Using_Active_Assignment_Rule"));
m = map();
resp = zoho.crm.invokeConnector(("crm.getusers"), m);
respMap = (resp.get("response")).toMap();
users = respMap.get("users");
userList = users.toJSONList();
userIds = List();
for each user in userList
      eachUser = user.toMap();
max_lead_level = (userIds.size()).toLong();
ans = (abs((l_number  %  max_lead_level))).toLong();
if (rule  ==  "true")
      ownerid = userIds.get(ans);
      updateMap = { "Lead_Owner" : ownerid, "id" : lead_id + "" };
      m = map();
      l = List();
      m.put("module", "Leads");
      m.put("data", l);
      resp = zoho.crm.invokeConnector("crm.update", m);

The above code is used to automatically assign leads to your users using round robin method by getting the user data.

Mentioned below is the response generated for the above code:

{"status_code":200,"response":"{"users":[{"zip":6000049,"phone":9876543210,"fax":null,"status":"active","website":"","street":null,"state":"Tamil Nadu",
"email":" ","dob":22.2.1993,"last_name":Demo,"time_format":null,
"role":"CEO","user_id":"1297376000000094003","language":"en_US","confirm":true,"mobile":"9500080429","full_name":"Zoho Demo ","profile":"Administrator"},{"zip":null,"phone":null,"fax":null,"status":"deleted","website":null,"street":null,"state":null,"country":null,"city":null,
"alias_name":null,"first_name":"Zoho1","timezone":"Asia/Kolkata","zuid":null,"email":" ",
"language":"en","confirm":true,"mobile":null,"full_name":"Zoho1 Demo1","profile":"Administrator"}]}"}


  • This task is used to fetch the information of all the users in your CRM account. You can also fetch details of selective users by explicitly mentioning it in the map() function.
    For example: If you want to fetch the details of only the active users, the code will be
    m= map();
    m.put("type", "ActiveUsers");
    <CRM Response> = zoho.crm.invokeConnector("crm.getusers", m);
  • Similarly you can also fetch the details of Deactivated users, Confirmed users, Not confirmed users, Deleted users, Active confirmed users, Admin users, Active confirmed admins, and Current user.

 Related Links 

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: