Fetch All Records From A Module In Zoho CRM Without Limits (1, 200).

Fetch All Records From A Module In Zoho CRM Without Limits (1, 200).

Connection Scope:
Scope = ZohoSearch.securesearch.READ
(and)
ZohoCRM.modules.{module_name}.READ

Pass Module's API Name As Function's Argument.
///////////////////////////////// Counting how many page of records exist in a module (Per Page 200 is limit) //////////////////////////////////////
Dmap = Map();
resp = invokeurl
[
url :"https://www.zohoapis.eu/crm/v3/" + Module_Name + "/actions/count"
type :GET
parameters:Dmap
connection:"getallrecordsfrommodule"
];
//info "resp: " + resp;
RespCount = resp.get("count").toLong();
if(RespCount > 0)
{
page = RespCount / 200;
//info "page: " + page;
if(page > 0 && page < 1)
{
no_Of_Page = 1;
}
else
{
page = page.toString();
if(page.contains("."))
{
page = page.toLong();
no_Of_Page = page + 1;
}
else
{
no_Of_Page = page;
}
}
}

//// Converting No Of Pages Into List and iterating in a For loop For the no of count of pages & getting all records from each page & returning it in a list ///

if(no_Of_Page.toLong() == 1)
{
num = no_Of_Page.toLong();
myList = "".leftpad(num).replaceAll(" ","0").toList();
}
if(no_Of_Page.toLong() != 1)
{
num = no_Of_Page.toLong() - 1;
myList = "".leftpad(num).replaceAll(" ","0,").toList();
}
Pag = 0;
AllRecords = List();
for each pagg in myList
{
Pag = Pag + 1;
for each  loop in zoho.crm.getRecords(Module_Name,Pag,200)
{
AllRecords.add(loop);
}
}
AllRecords = AllRecords.tolist();
return AllRecords;