Find deal by condition
The Find deal robot searches Bitrix24 deals by contact or company ID, stage, assigned user, or a custom JSON filter, with sorting and a limit of up to 50 results. It returns the first deal ID and title, all found IDs, the count, and a Found flag (Y/N). Works in Bitrix24 business processes and robots.
The robot searches Bitrix24 CRM deals by the given conditions: contact ID, company ID, stage (e.g. WON or C1:NEW), assigned user, and a custom JSON filter for non-standard conditions that is merged with the other fields. Sorting by creation date, modification date, or ID is available, with a result limit from 1 to 50 (default 5). Typical cases: find an open deal of a contact to avoid creating a duplicate on a repeat inquiry, or get the latest deal of a company before changing its stage. Returns the ID and title of the first deal, all found IDs, the count, and a Found flag (Y/N) — build a condition on it in the workflow designer and pass the IDs to the next robots.
What input parameters does the robot accept?
| Parameter | Type | Required? | Default |
|---|---|---|---|
| Contact ID | int | — | |
| Company ID | int | — | |
| Stage (e.g. WON, LOSE, C1:NEW) | string | — | |
| Assigned user ID | int | — | |
| Custom filter (JSON, e.g. {"CLOSED":"N"}) | string | — | |
| Sort by: CREATED_DATE / DATE_MODIFY / ID (default DATE_MODIFY DESC) | string | — | |
| Maximum results (default 5) | int | — |
What does the robot return?
| Parameter | Type |
|---|---|
| ID of the first deal found | int |
| Title of the first deal | string |
| All found IDs | int |
| Number of deals found | int |
| Found (Y/N) | string |
Scenario: avoid duplicate deals for a contact
- A new website request starts a business process on the contact
- The robot searches for open deals of this contact using the filter CLOSED=N
- If a deal is found, the request is added to it; otherwise a new deal is created