Get User Data

Table of Contents

The details about the users of an extension or vertical solution can be fetched using the zoho.crm.getRecords() deluge task.

Note:

  • This task can be performed only in Zoho CRM Vertical Solutions.
  • Each time the zoho.crm.getRecords integration task is executed, it triggers an API request in the back-end. This call is deducted from the external calls limit available for the service from which the task is executed, based on your pricing plan.
  • Only actual executions that receive a response (whether success or failure) are counted, not the number of times the task appears in the script. For example, if zoho.crm.getRecords integration task is placed inside a for each task that iterates five times, the number of external calls consumed will be five, even though the task appears only once in the script. 

Syntax

<Response> = zoho.crm.getRecords("users", <page Long>, <perPage Long>, <userTypeMap map>);

where:

ParamsData typeDescription
<Response> KEY-VALUE Indicates the task response.
<page> NUMBER Indicates the page number from which you want to retrieve records. The default value is 1.
<perPage> NUMBER Specifies the number of records that need to be fetched per page. The default value is 200.
<userTypeMap> KEY-VALUE specify the user Type. You can fetch All Users, Admin Users, Active Users, and Inactive Users using the key, value pairs ("type","AllUsers"), ("type","AdminUsers"), ("type","ActiveUsers"), and ("type","DeactiveUsers") respectively. 

Example

Fetch all the active users associated with an extension or vertical solution.

response = zoho.crm.getRecords("users",1,200,{"type":"ActiveUsers"})
info response;

Response Format

Success Response

  • The success response will be returned in the following format.

    { "users": [ { "country": null, "role": { "name": "CEO", "id": "2853142000000026005" }, "city": null, "language": "en_US", "locale": "en_US", "microsoft": false, "Isonline": false, "Modified_By": { "name": "Latha Velu", "id": "2853142000000131009" }, "street": null, "alias": null, "id": "2853142000001501001", "state": null, "fax": null, "country_locale": "US", "first_name": "Brenda", "email": "lathav.spring@gmail.com", "Reporting_To": null, "zip": null, "created_time": "2019-07-30T11:26:00+05:30", "Modified_Time": "2019-07-30T11:26:00+05:30", "website": null, "time_format": "hh:mm a", "offset": 19800000, "profile": { "name": "Administrator", "id": "2853142000000026011" }, "mobile": null, "last_name": null, "time_zone": "Asia/Kolkata", "created_by": { "name": "Latha Velu", "id": "2853142000000131009" }, "zuid": "663254876", "confirm": true, "full_name": "Brenda ", "territories": [], "phone": null, "dob": null, "date_format": "MM/dd/yyyy", "status": "active" }, { "country": "null", "role": { "name": "CEO", "id": "2853142000000026005" }, "customize_info": { "notes_desc": null, "show_right_panel": null, "bc_view": null, "show_home": false, "show_detail_view": true, "unpin_recent_item": null }, "city": null, "signature": null, "name_format": "Salutation,First Name,Last Name", "language": "en_US", "locale": "en_US", "microsoft": false, "personal_account": false, "Isonline": true, "default_tab_group": "0", "Modified_By": { "name": "Latha Velu", "id": "2853142000000131009" }, "street": null, "alias": null, "theme": { "normal_tab": { "font_color": "#FFFFFF", "background": "#222222" }, "selected_tab": { "font_color": "#FFFFFF", "background": "#00FFFFFF" }, "new_background": null, "background": "#F3F0EB", "screen": "fixed", "type": "default" }, "id": "2853142000000131009", "state": "null", "fax": null, "country_locale": "US", "first_name": "Latha", "email": "latha.v@zohocorp.com", "Reporting_To": null, "zip": null, "decimal_separator": "en_US", "created_time": "2017-11-01T22:37:11+05:30", "Modified_Time": "2017-11-01T22:37:11+05:30", "website": null, "time_format": "hh:mm a", "offset": 19800000, "profile": { "name": "Administrator", "id": "2853142000000026011" }, "mobile": null, "last_name": "Velu", "time_zone": "Asia/Calcutta", "created_by": { "name": "Latha Velu", "id": "2853142000000131009" }, "zuid": "650456410", "confirm": true, "full_name": "Latha Velu", "territories": [], "phone": "null", "dob": null, "date_format": "MM/dd/yyyy", "status": "active" } ], "info": { "per_page": 200, "count": 2, "page": 1, "more_records": false } } }}

Additional-Example

Round Robin Assignment

Assign Leads to your users using the round robin method.

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();
datalist = resp1.get("data").toJSONList();
reqq = datalist.get(0).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();
     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 = Map();
     updateMap.put("Lead_Owner" : ownerid);
     resp = zoho.crm.update("Leads",lead_id,updateMap);
}

Response Format

Success Response

{ "status_code": 200, "response": "{"users":[{"zip":6000049,"phone":9876543210,"fax":null, "status":"active","website":"http: //www.zoho.com","street":null,"state":"TamilNadu", "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":"ZohoDemo","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":"Zoho1Demo1","profile":"Administrator"}]}" }

Related Links