R
R
Ruslan Ruslanov2019-09-02 15:11:16
Bitrix24
Ruslan Ruslanov, 2019-09-02 15:11:16

How to bypass recursive event call in Bitrix24-api?

A cloud solution for the portal is used.
It also uses a ready-made library for this.
I have been working with Bitrix24-api for only a couple of days, until I know all the nuances.
Accounts need to be updated.
I hung a handler on the update event, I update ...

$bitrix_app->call('crm.invoice.update', [
            'id' => $id,
            'fields' => [
                $field => $array
            ]
        ]);

... and this event calls the oncrminvoiceupdate handler and my script is called again...
So far, I've only thought of doing unbind before updating the invoice.
What other options are there?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kulgan, 2019-09-02
@kulgan

unbind is not an option, but what if another account wants to update at that moment)?
There is an option in the invoices before sending "crm.invoice.update" to check whether the fields that need to be updated are updated and decide whether to send or not.
If you need to update by calling "crm.invoice.update" 1 time for the whole time, then you can add an additional field in which to set the status "updated" and then check it before updating.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question