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.

Syntax

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

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

 Example

lead_id = input.lead.get("LEADID");
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);
info resp;
respMap = (resp.get("response")).toMap();
users = respMap.get("users");
temp = users.replaceAll("[","",true);
usersVal = temp.replaceAll("]","",false);
userList = usersVal.replaceAll("},{","}-|||-{",true).toList("-|||-");
userIds = List();
for each index ind in userList
{
eachUser = (userList.get(ind)).toMap();
if (eachUser.containKey("user_id"))
{
   userIds.add(eachUser.get("user_id"));
}
else
{
userIds.add(eachUser.get("id"));
}
   }
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();
  l.add(updateMap);
  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":"http://www.zoho.com","street":null,"state":"Tamil Nadu",
"country":"in","city":"Chennai","alias_name":null,"first_name":"Zoho","timezone":"Asia/Calcutta","zuid":"3032021",
"email":"platform+demo@zohocorp.com ","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":"platform+demo1@zohocorp.com ",
"dob":null,"last_name":"Demo1","time_format":null,"role":"CEO","user_id":"1297376000000108007",
"language":"en","confirm":true,"mobile":null,"full_name":"Zoho1 Demo1","profile":"Administrator"}]}"}

Note

  • 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

https://www.zoho.com/crm/help/api/getusers.html 

Share this post :

FacebookTwitter

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

Write to us: support@zohodeveloper.com