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 (Alaio) 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. Roboteka's 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, and also deduplicate, sort, sum, delete an item from a list and output a list as a table.
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.
How do I get the last added value?
Bitrix24 stores the values of a multiple field in the order they were added, so "the last added" is simply the last item of the list. The Get array item by index robot with index −1 returns it without counting the length; −2 gives the one before it. A nuance for fields of the "list" and "CRM item binding" types: such a field reaches the business process as a list of IDs — of list values or of the bound items — not of names. Index −1 gives you the ID of the last item; to read its name, phone or any other field, chain the Get field value from a related entity robot — it takes the entity type, that ID and a field code. Example: a deal has a multiple "Approvers" field bound to contacts — the process takes the last added one and pulls their email into the notification.
How do I turn a comma-separated string into a multiple field?
Values from a form or an integration often arrive as one string: "installation, delivery, warranty". The Split string by delimiter robot cuts it into a list of parts; the delimiter is taken literally, so for a string with a comma and a space set "comma plus space" as the delimiter, otherwise the parts keep a leading space. The result is an ordinary array: write it into a multiple field as a whole with the stock "Modify document" action (the field is overwritten — for an empty field that is exactly what you want), or append the values one by one to the existing ones with Add a value to a multiple field. More on splitting and joining in the article on strings in business processes.
How do I delete an item from an array or clear a list?
Two different cases. If a value has to go from a field on the card, that is Remove a value from a multiple field — it edits the entity itself. If the list lives in a process variable or came from another robot and the card must stay untouched, use Delete element from array. Two modes: by value — every match is removed, case-insensitively by default; by index — one item, 0 the first, −1 the last. Output: the array after deletion, how many items were removed and the resulting count. Clearing a multiple variable entirely is easier with the stock tools — the "Modify variables" action with an empty value; a multiple field on the card is emptied by the Clear a field robot, because an empty string in the stock modify-document action does not work for such fields. The delete robot is for when one value leaves the list: the first phone in the queue has been handled — remove it by index 0 and pass the rest on.
How do I remove duplicates and compare two lists?
Remove duplicates from array keeps only unique values and preserves the order of first occurrences; comparison is case-insensitive by default, with an option for strict matching. Output: the array without duplicates, the number of unique items and how many repeats were dropped. A typical case: the phones of a company and of its contacts gathered into one variable before a mailing — after the robot no number gets two messages. The same robot helps compare two multiple fields. Item by item — Check whether a value is in an array inside the stock "Loop" construct: a value from field A is looked up in field B. As a whole — gather both lists into one variable and run deduplication: if neither field repeats values internally and the number of dropped repeats equals the number of items in field B, field B is fully contained in field A.
How do I sum the values of an array?
A multiple "Payments" field or a list of amounts from a split string is added up by the Sum of array elements robot. It understands a comma as the decimal separator and spaces inside numbers ("1 500,50"), skips non-numeric items and reports separately how many were skipped — a process condition on that counter catches "text got into the field". Output: the sum and the number of items counted. The sum is usually rounded next and placed into a deal field or an email — rounding and percentages have their own article on calculations in business processes.
How do I sort an array?
The stock tools do not sort a list, and sorting numbers as strings gives the order "1, 10, 2". The Sort an array robot orders items ascending or descending; the type is detected automatically — all items numeric means numeric comparison, otherwise alphabetical as strings — and can be forced. Output: the sorted array and the item count. Paired with get-by-index it answers "the largest payment": sort descending, take item 0; "the three earliest dates": sort ascending, take 0, 1 and 2.
How do I output a list as a table in an email or notification?
Substituting a multiple field into text yields the values separated by commas. For a readable email use the HTML table from an array robot: each array item becomes a table row, a delimiter inside the item (semicolon by default) splits it into columns, and a separate field sets the header row. Output: ready HTML code of the table, the number of rows and columns. Recipe: a list of line items "name;quantity;amount" collected in a variable as the process runs goes to the client by email as a table. How to deliver such an email or notification is covered in the article on notifications from a business process.
Bottom line
The 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 on the card — Add a value to a multiple field and Remove a value from a multiple field, process a list without writing to the card — Delete element from array, Remove duplicates from array, Sort an array, Sum of array elements, HTML table from an array. 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.