Multiple fields — phones, emails, tags — hold several values at once, and robots return lists too: for example, the parts of a split string. The stock actions of Bitrix24 business processes handle lists poorly: substitution glues all the values into one string, and writing to a multiple field wipes out whatever was already there. Five robots cover array work: get an item by index, count items, check whether a value is present, add and remove a value of a multiple field.
Where do arrays come from in a business process?
Three sources. Multiple entity fields: a contact's phones and emails, custom fields flagged "multiple" — tags, categories, a list of branches. Multiple process variables, where values accumulate as the branches run. And the results of other robots: splitting a string by a delimiter returns a list of parts, extracting by a pattern returns a list of matches. With such a list the stock tools can do little: substitution into text joins the values with commas, a condition checks membership against the joined string. Taking the second phone specifically, counting the tags, or carefully appending a value without touching the rest — those are already tasks for the robots below.
How do I get the first, last or Nth item?
The Get array item by index robot accepts an array of values and an index: 0 — the first item, 1 — the second, −1 — the last, −2 — the second-to-last. Output: the item and an "Item exists" flag (Y/N); if the index is out of the array's bounds, an empty value and an N flag are returned — the process won't stop, and a condition branch handles the missing data. Typical chains: split a full-name string by a space — take the first item as the surname; split an address by a comma — take the last item as the house number; from a list of regular-expression matches, take the first. The result is written into an ordinary single field or variable for the next steps.
How do I count items and check whether a value is present?
Two "question" robots. Array size / item count returns the count and an "Array is empty" flag (Y/N); empty strings are not counted by default — a stray empty slot in a multiple field won't spoil the count. Check whether a value is in an array looks for an exact match of an item — not a substring — case-insensitively, with an option to switch on strict comparison. Output: a "Found" flag (Y/N) and the index of the first match, minus one if there are no matches. Use in process conditions: "the deal already has a VIP tag — skip the discount", "the contact has zero phones — a task for the manager to complete the card before it goes to the call list".
How do I add a value to a multiple field without wiping the rest?
The main pain of multiple fields: the stock modify-document action writes the field as a whole, and while adding one tag it's easy to erase the existing ones. The Add a value to a multiple field robot appends a value carefully: it reads the field's current contents on the entity and adds the new one to the existing ones. Input: the entity type — deal, contact, company or lead — the entity ID substituted from the current document, the field code (for example, UF_CRM_TAGS or PHONE) and the value itself. The "don't add if already present" option is on by default: a repeat run of the process won't breed duplicate values. Output: a "Success" flag (Y/N) and the resulting count of items in the field.
How do I remove a value from a multiple field?
The reverse operation — take off a tag, remove an outdated phone. By hand this means opening the card and editing the field; with a stock action — rewriting the field as a whole with all the risks. The Remove a value from a multiple field robot accepts the entity type, the ID, the field code and the value to remove. All occurrences of that value are removed, and the remaining items stay in place. Output: a "Success" flag (Y/N), how many occurrences were removed, and the resulting count of items in the field. A recipe: a deal closes as won — the process takes the "in progress" tag off the company and, with the neighboring add robot, appends the "client" tag; the card always reflects the current status with no manual editing.
Bottom line
Five robots cover the array lifecycle: get an item — Get array item by index, count — Array size / item count, check — Check whether a value is in an array, change a multiple field — Add a value to a multiple field and Remove a value from a multiple field. All are in the Roboteka catalog, free from the Bitrix24 Market. No array operation fits your need — describe the task, we build the robot for free.