Home > OS >  how can I get the next set of items from the crm.lead.list method?
how can I get the next set of items from the crm.lead.list method?

Time:09-24

I am trying to create a list of leads of more then 50 items so I encounterd the limit of the list method. On the training site I already found that I need to do a call to get the next set but I have found no mention of how that should be done in php all examples are in javascript so that is of no help.

The current method calls I have tried to get it working but I only get the same set as a result:

$fistSet = CRest::call("crm.lead.list", [
  "order"=> [ "ID"=> "ASC" ],
  "filter"=> [ "UF_CRM_1600929716160"=> 632],
  "select"=> [ "ID", "TITLE", "STATUS_ID", "OPPORTUNITY", "CURRENCY_ID" ]
]);
echo "<pre>";
var_dump($fistSet);
echo "</pre>";
echo "<br>----------------------------------------------------------------------------------------------------------------------------------------------------------------------------<br>";
$total = $firstSet["total"];
$next = $firstSet["next"];
$secondSet = CRest::call("crm.lead.list", [
  "order"=> [ "ID"=> "ASC" ],
  "filter"=> [ "UF_CRM_1600929716160"=> 632], "OFFSET"=>$next,
  "select"=> [ "ID", "TITLE", "STATUS_ID", "OPPORTUNITY", "CURRENCY_ID" ]
]);
echo "<pre>";
var_dump($secondSet);
echo "</pre>";

CodePudding user response:

Assuming this is for Bitrix, their documentation says the response from next should be passed in a start property in your next request. So swap offset to start.

  • Related