G
G
gian_tiaga2021-06-11 17:47:57
API
gian_tiaga, 2021-06-11 17:47:57

AmoCrm filtering by an additional field like date, bug or api curve?

$range = new BaseRangeFilter();
$range->setFrom($this->from->getTimestamp())
    ->setTo($this->to->getTimestamp());

$filter = new LeadsFilter();

$filter->setStatuses($successStatusesFormatted);
$filter->setPipelineIds([$pipeline['id']]);
$filter->setResponsibleUserId($id);
$filter->setCustomFieldsValues([
    data_get($additional, 'date_finished_field') => $range,
]);
$filter->setLimit(250);


AmoCRM\Filters\LeadsFilter {#2231 ▼
  -ids: null
  -names: null
  -price: null
  -createdBy: null
  -updatedBy: null
  -responsibleUserId: array:1 [▼
    0 => 5762869
  ]
  -createdAt: null
  -updatedAt: null
  -closedAt: null
  -closestTaskAt: null
  -statuses: array:5 [▼
    0 => array:2 [▼
      "status_id" => 30188239
      "pipeline_id" => 2099032
    ]
    1 => array:2 [▼
      "status_id" => 32611630
      "pipeline_id" => 2099032
    ]
    2 => array:2 [▼
      "status_id" => 32611633
      "pipeline_id" => 2099032
    ]
    3 => array:2 [▼
      "status_id" => 32611636
      "pipeline_id" => 2099032
    ]
    4 => array:2 [▼
      "status_id" => 142
      "pipeline_id" => 2099032
    ]
  ]
  -pipelineIds: array:1 [▼
    0 => 2099032
  ]
  -customFieldsValues: array:1 [▼
    421713 => array:2 [▼
      "from" => 1622494800
      "to" => 1625086799
    ]
  ]
  -query: null
  -orderField: null
  -direction: null
  -page: 1
  -limit: 250


$leads = $this->amoService->getApiClient()->leads()->get($filter);


There is an additional field of the date type, I'm trying to get transactions filtered by it and from 1 funnel of certain statuses.
But it returns all transactions by these statuses and that's it. That is, it does not filter exactly by customFieldsValues

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question