Fetch Records

Fetching Records

Table of Contents

You can fetch records from a CRM module using the invoke connector task.


<CRM Response> = zoho.crm.invokeConnector("crm.get", <Module detail as Map>);


<CRM Response> is the map variable returned by CRM as response.

<Module detail as Map> is the module in CRM you're fetching records from. The map should have the key, value pair as {"module": "<API name of module>"}.


  • This task can fetch up to 200 records at a time. To fetch more than 200 records, repeat the task mu ltiple times with different fromIndexes and toIndexes.
  • If you don't add a fromIndex or toIndex, CRM will return the first twenty records by default..
  • The fetch records task is equivalent to https://zohocrmapi.wiki.zoho.com/getRecords-Method.html#Request_URL 


  1. We have created one custom module named Clients.
  2. We fetched custom fields like Locality, Parking Places, Bedrooms (By using the map Clients) from the current record of the Clients
  3. Using crm.getRecords  all records of the module potentials were fetched and then we have compared all fields mentioned above of all the Clients
  4. Then we updated all  the matching records in the potential module

clientId = input.client.get("Clients.ID");
Locality = input.client.get("Locality");
Parking_Places = input.client.get("Parking_Places");
Bedrooms = input.client.get("Bedrooms");
if (((!((isNull(Bedrooms) || isNull(Parking_Places)) || isNull(Locality)) && (Bedrooms != "")) && (Parking_Places != "")) && (Locality != ""))
      moduleMap = {"module": "Potentials"};
      crmResp = zoho.crm.invokeConnector(("crm.get"), moduleMap);
      resp = crmResp.get("response").toMap();
      allPotentialRecords = resp.get("data").toJSONList();
      mylist = List();
      for each potentialRecord  in allPotentialRecords
            respMap = potentialRecord.toMap();
            potential_Locality = respMap.get("Locality");
            potential_Parking_Places = respMap.get("Parking_Places");
            potential_Bedrooms = respMap.get("Bedrooms");
            if ((Parking_Places.equalsIgnoreCase(potential_Parking_Places) && Locality.equalsIgnoreCase(potential_Locality)) && Bedrooms.equalsIgnoreCase(potential_Bedrooms))
                  //add related list record here
                  custommodulemap = map();
                  custommodulemap.put("Client_ID", clientId + "");
                  dataList = List();
                  updateMap = {"module": "Potentials", "data": dataList};
                  dealMap = zoho.crm.invokeConnector("crm.update", updateMap);

Mentioned below is the response generated for the above code:

{"status_code":200,"response":"{"data":[{"Bedrooms":"2","Probability":20,"Description":null,"Amount":0,"Account_Name":{"id":"1297376000000126009","name":"ZohoAccount"},"Modified_By":{"id":"1297376000000094003","name":"ZohoAcc "},"Closing_Date":"2016-06-14","Type":null,"Expected_Revenue":0,"Lead_Source":null,"Contact_Name":null,"Created_Time":"2016-06-14T16:52:43+05:30","Modified_Time":"2016-07-05T14:33:28+05:30","Created_By":{"id":"1297376000000094003","name":"ZohoAcc "},"Potential_Owner":{"id":"1297376000000094003","name":"ZohoAcc "},"$approved":true,"Last_Activity_Time":"2016-07-05T14:33:28+05:30","id":"1297376000000126013","Next_Step":null,"Locality":"Kingston","Parking_Places":"Main Area","$approval":{"approve":false,"reject":false,"delegate":false},"Potential_Name":"ZohoTest","Stage":"Needs Analysis","Campaign_Source":null}],"info":"{\"per_page\":200,\"count\":1,\"page\":1,\"more_records\":false}"}}

 Related Links


Share this post : FacebookTwitter

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

Write to us: support@zohodeveloper.com