The “Add to Collection” action in PowerTools for Microsoft Power Automate allows flow designers to modify an existing collection or array object with new entries.
For example, a new entry of “Hat” could be inserted at the end of a collection consisting of three entries (“Keys”, “Wallet”, “Phone”) by specifying an input variable and setting the “Item” value in the action to “Hat”. This would produce a result of “Keys”, “Wallet”, “Phone”, “Hat”.
In addition, by specifying the “Index” value, the new item could be inserted anywhere in the collection – beginning, middle, end, or somewhere in between (by default, if no “Index” value is specified, the new item inserted at the end of the target collection).
Advanced users might want to insert an entire collection into the existing collection, such as adding “Hat”, “Coat”, “Gloves” to the list. This is accomplished by creating a new variable in which to store the collection of additional items, then setting that variable as the value for the “Items” field. Just as with individual values, the new collection can be inserted at any location by setting the “Index” value.
Watch the video below for a step-by-step demonstration.