Get array element by index
The "Get array element by index" robot returns a single element from an array of values by position in Bitrix24 (Alaio) business processes and robots. It takes a multiple-value field or another robot output and an index: 0 is the first element, -1 the last, -2 the second to last. It returns the element value and an Element exists Y/N flag.
The robot extracts a value from an array by position, which is needed when another robot or a multiple-value field returns a list and the process needs one specific element. The input is a multiple-value field (such as contact phones, deal products) or an array from a previous step plus an index; positive values count from the start (0 = first), negative ones from the end (-1 = last, -2 = second to last). Typical use cases: take the first contact phone for a call; get the last value added to a multiple-value field; pull the needed element from a string-split robot output. If the index is out of the array bounds, an empty value is returned and Element exists = N. It returns the element value and a Y/N flag — use them in the next steps of the business process.
What input parameters does the robot accept?
| Parameter | Type | Required? | Default |
|---|---|---|---|
| Array of values | string | yes | |
| Index (0 = first, -1 = last, -2 = second to last…) | int | — |
What does the robot return?
| Parameter | Type |
|---|---|
| Array element | string |
| Element exists (Y/N) | string |
Scenario: call the contact first phone
- A contact enters the In progress stage
- The robot takes the element at index 0 from the contact phone multiple-value field
- When Element exists = Y the process initiates a call to the retrieved number