P
P
PlanetaFx2020-01-28 16:02:43
Marketing
PlanetaFx, 2020-01-28 16:02:43

How to automatically change the status of a lead after reading a letter in Bitrix24 (cloud)?

How to automatically change the status of a lead after reading a letter in Bitrix24 (cloud)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
karram, 2020-01-31
@karram

Set a trigger that the letter has been read in the status in which you need to transfer the lead.
5e33c46f70c25258333299.jpeg

R
Roman, 2020-02-03
@Ramapriya

Robots are not available on the free plan, but you can use the Rest API
. To do this, you need to create an outgoing webhook for the Case Update event, specify a link to the handler, and write the following code in the handler itself (you will need the CRest SDK class to work ):

require __DIR__.'/crest.php'; 

if($_REQUEST['event'] == 'ONCRMACTIVITYUPDATE') {
         $activityID = $_REQUEST['data']['FIELDS']['ID']; 
         
         $activity = CRest::call('crm.activity.get', ['ID' => $activityID]); // получаем информацию о деле
         
// проверяем, что письмо было отправлено лиду, а не другой crm-сущности, а также что поле даты прочтения письма не пустое
         if($activity['result']['OWNER_TYPE_ID'] == 1 && !empty($activity['result']['SETTINGS']['READ_CONFIRMED'])) {
// переводим лид в нужный статус
            $updateLead = CRest::call('crm.lead.update', [
                 'ID' => $activity['result']['OWNER_ID'],
                 'FIELDS' => [
                     'STATUS_ID' => 'IN_PROCESS'
                 ]
             ]);
         }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question