Previous value of a field
The "Previous value of a field" robot returns, inside a Bitrix24 (Alaio) workflow, what a field held before its last change: the previous value, the new value, the time of the change and the ID of the user who made it. It works with deals, leads, contacts, companies and smart processes and needs field change history to be switched on.
The robot reads the change history the app keeps on your Bitrix24 (Alaio) portal and returns the last change of one field: the value before, the value after, the time and the ID of the user. Field change history must be switched on in the app settings; if it is off, or the field has never changed, the robot does not fail but returns the "found" flag = N, so the normal path needs no error handling. The field is given by its code as the Bitrix24 REST API returns it: title, opportunity, ufCrm_123; phones, emails, websites and messengers are phone, email, web, im. By default the robot uses the item the workflow runs on; the "by ID" modes cover workflows running on a different item. If the field was changed in the background with no user (for example, by a robot or a workflow after a pause), the "no user" flag is Y and the user ID is 0.
What input parameters does the robot accept?
| Parameter | Type | Required? | Default |
|---|---|---|---|
| Field code (for example title, opportunity, ufCrm_123; for phones, emails, websites and messengers: phone, email, web, im) | string | yes | |
| Item | select | — | auto |
| Item ID (for the "by ID" modes) | string | — | |
| Smart process type ID (for the smart process mode only) | string | — |
What does the robot return?
| Parameter | Type |
|---|---|
| Field value before the last change | string |
| Field value after the last change | string |
| When the field last changed | datetime |
| ID of the user who made the change; 0 when it was made in the background with no user. For a change the history has not recorded yet, the last editor of the item | int |
| The change was made in the background with no user (for example, by a robot or a workflow after a pause); also Y for a change the history has not recorded yet (Y/N) | bool |
| Change found (Y/N) | bool |
| Success | bool |
| Result message | string |
What errors can the robot return?
The robot writes these messages to the business process log when it cannot complete a step. The text tells you what to fix in the settings or the data.
- The field code is empty.
- This item has no change history. The robot works with leads, deals, contacts, companies and smart processes; for the "by ID" modes provide a valid ID.
- Could not read the change history. Run the step again later; if the error repeats, contact support.
Scenario: notify the manager when a deal amount is lowered
- The robot sits on the Approval stage and reads the opportunity field
- It returns the previous and the new amount and the ID of the employee who changed it
- If the new amount is lower than the previous one, the manager gets a notification with both figures