Count files in a field
The Count Files in a Field robot counts how many files are attached in a given file field of a Bitrix24 (Alaio) CRM entity — a deal, contact, company or lead. The inputs are the entity type, its ID and the file field code. It returns the file count (count) and a has_files flag with the value Y or N for conditional branching.
The robot opens the CRM entity by type and ID, reads the specified file field and counts the attached files. The inputs are: the entity type (deal, contact, company or lead), the entity ID and the file field code. The outputs are: count — the number of files in the field, and has_files — a flag of Y if at least one file is present, otherwise N. Use it to verify before a deal stage change that the client attached documents, to stop a card with an empty attachments field from moving forward, or to trigger a separate branch when there are no files. If the parameters are invalid or the entity is not found, the robot returns count 0 and has_files N. The has_files flag is convenient to compare in the condition of the next step of the business process.
What input parameters does the robot accept?
| Parameter | Type | Required? | Default |
|---|---|---|---|
| Entity type: deal / contact / company / lead | string | yes | |
| Entity ID | int | yes | |
| File field code | string | yes |
What does the robot return?
| Parameter | Type |
|---|---|
| File count | int |
| Has files (Y/N) | string |
Scenario: check for documents in a deal
- A deal enters the Documents received stage
- The robot counts the files in the deal attachments field
- On has_files = Y the process moves on, on N it creates a task to request the documents