How to move a lead or a deal along sales funnel

Lesson 8 out of 29

One can employ REST API to advance a lead or a deal through the sales funnel to the appropriate stage.

How to move a lead or a deal along sales funnel

5 min

Let us venture into the "Automate Sales" section, where we find ready-to-utilize templates for both lead and deal. As part of this lesson, we shall select "Move a deal along the sales funnel". We shall download the completed example and upload it to the server in the same manner as we did in the "Local Integrations" lesson.

A pre-prepared incoming webhook awaits us, which we shall use to advance the deal to the correct stage in the funnel.

A cursory examination of the example code reveals that it leverages a single method to update the deal, for which we must specify the deal's identifier and the desired stage's identifier. The example employs the predefined identifier WON, which enables us to move the deal to a successfully closed status.

Let us return to the Bitrix24 interface and select a deal from our Kanban. Upon opening the deal's form, its identifier can be gleaned from the address bar.

We shall then substitute this identifier in the code and run the example by opening index.php in the browser. The example works, and when we return to the CRM, we find our deal moved to the "Deal Won" status.

But how do we determine the IDs of custom stages if they are not system stages?

We can make use of the "Developer Resources" section to obtain the necessary information. Let us utilize the "Request Builder".

We shall choose the method crm.status.list, and as a parameter, specify the filter which will enable us to retrieve the deal statuses. Set the filter parameter in the ENTITY_ID field to DEAL_STAGE.

Let us run the query directly in the request builder. Bitrix24 presents the results in both a JSON string format and a decrypted data array, which contains all information regarding the deal stages, including the required identifiers.

For instance, if we need to automatically move transactions to the Prepayment Invoice stage, we must specify the corresponding stage ID when calling the crm.deal.update method.

Useful

There is a more flexible way to progress a deal or lead through the funnel, such as with a custom CRM trigger added through REST API tools. This subject shall be covered in a subsequent lesson.

Resources

Lesson materials: