Hello,
I have a module in a custom app where I need to retrieve lead data from multiple pages and compile all the results into a single array. Each page returns 10 leads, but I want to aggregate data from all pages, sort the combined results, and return the full sorted list in the output.
Currently, the code only handles data page by page (10 leads at a time), but I need a solution that processes and sorts all the lead data at once across all pages.
Note : API doesn’t support sorting of lead data.
How can make change in the module code to get this sorted result?
Below is the current code from the module:
{
// Request to API endpoint.
“url”: “/accounts/{{parameters.accountId}}/custom-feeds/{{parameters.customFeed}}/leads”, // Relative to base URL
“method”: “GET”,
“headers”: {},
“qs”: {
“start_date”: “{{parameters.startDate}}”,
“end_date”: “{{parameters.endDate}}”
},
// Response handling
"response": {
"output": "{{parseLeadData(body)}}"
},
"pagination": {
"condition": "{{body.links.next.href}}",
"url": "{{body.links.next.href}}"
}
}
Help needed!!!
Please recommend your suggestion.