Fetching Records

You can fetch records from a module in an Extension or Vertical Solution using the zoho.crm.getRecords() deluge task.

Syntax

<Response> = zoho.crm.getRecords(<module String>,<page Long>,<perPage Long>);

where,
<Response> is the task response returned as a List.

Parameters

NameDatatypeDescriptionMandatory
moduleStringSpecify the API name of the module from which you want to fetch records.Yes
pageLongIndicates the page number from which you want to retrieve records. The default value is 1.No
perPageLongSpecifies the number of records that need to be fetched per page. The default value is 200.No

 Example

From the Deals module, retrieve all records whose deal value (Amount) is 1000 dollars or more. In those records, update a custom field Commission with value 500.

resp = zoho.crm.getRecords("Deals");
info "resp: " + resp;
for each ele in resp
{
     if(ele.get("Amount") >= 1000)
     {
      taskId = ele.get("id");
      taskInfo = Map();
      taskInfo = {"Commission":500};
      response = zoho.crm.update("Deals",taskId,taskInfo);
      info "response: " + response;
     }
}

 Response Format

Shown below is the response generated for zoho.crm.getRecords. The response contains record details of two Deals.

{"Owner":{"name":"ZohoTest","id":"3388926000000166021"},"Description":null,
"$currency_symbol":"$","Campaign_Source":null,"$followers":null,"Closing_Date":"2018-10-09",
"Last_Activity_Time":"2018-10-25T11:56:25+05:30","Modified_By":{"name":"ZohoDemo",
"id":"3388926000000166021"},"Lead_Conversion_Time":null,"$process_flow":false,
"Deal_Name":"Deal4","Expected_Revenue":240,"Overall_Sales_Duration":0,
"Stage":"Needs Analysis","Account_Name":{"name":"Acme Inc","id":"3388926000000297008"},
"id":"3388926000000297088","$approved":true,"$approval":{"delegate":false,"approve":false,
"reject":false,"resubmit":false},"Modified_Time":"2018-10-25T11:56:25+05:30",
"Created_Time":"2018-10-22T12:47:15+05:30","Amount":1200,"$followed":false,"Probability":20,
"Next_Step":"yes","Commission":null,"$editable":true,"Prediction_Score":null,
"Contact_Name":null,"Sales_Cycle_Duration":0,"Type":null,"Lead_Source":null,
"Created_By":{"name":"ZohoTest","id":"3388926000000166021"},"Tag":[]},
{"Owner":{"name":"ZohoTest","id":"3388926000000166021"},"Description":null,
"$currency_symbol":"$","Campaign_Source":null,"$followers":null,"Closing_Date":"2018-10-24",
"Last_Activity_Time":"2018-10-25T11:56:11+05:30","Modified_By":{"name":"ZohoDemo",
"id":"3388926000000166021"},"Lead_Conversion_Time":null,"$process_flow":false,
"Deal_Name":"Deal2","Expected_Revenue":90,"Overall_Sales_Duration":2,
"Stage":"Qualification","Account_Name":{"name":"Acme Inc","id":"3388926000000297008"},
"id":"3388926000000297064","$approved":true,"$approval":{"delegate":false,"approve":false,
"reject":false,"resubmit":false},"Modified_Time":"2018-10-25T11:56:11+05:30",
"Created_Time":"2018-10-22T12:46:30+05:30","Amount":900,"$followed":false,"Probability":10,
"Next_Step":"yes","Commission":null,"$editable":true,"Prediction_Score":null,
"Contact_Name":null,"Sales_Cycle_Duration":2,"Type":null,"Lead_Source":null,
"Created_By":{"name":"ZohoTest","id":"3388926000000166021"},"Tag":[]}

This is the response for zoho.crm.update.

{"Modified_Time":"2018-10-25T11:56:36+05:30","Modified_By":{"name":"ZohoDemo","id":"3388926000000166021"},"Created_Time":"2018-10-22T12:47:15+05:30","id":"3388926000000297088","Created_By":{"name":"ZohoTest","id":"3388926000000166021"}}

 Related Links

https://www.zoho.com/crm/help/api/v2/#record-api