02-17-2026 06:14 AM
In workflows is it possible to add to a variable as part of a for each loop.
I want to check each networks security appliance for an inbound any any rule and then send an email with all the networks in it.
In python I would just add to a global list, is this possible in workflows?
thanks
02-18-2026 04:39 AM - edited 02-18-2026 04:40 AM
@hoylandpaul Yes, you can use a Set Variable activity inside of a For Each loop to append data to a Local variable and then use that variable later in a Send Email activity. Note that to append data to a variable, you reference the same variable in the Variable to update field, and then again as the first variable in the New value field, followed by the new data (one or more additional variables). See the example below. Note that with this approach, you may have to normalize the string and remove a leading comma (,).
Another option is to use Table activities. Here's an example where a For Each loop is checking multiple organizations for networks with a specific tag. If networks are found, the networks are read into a table, and then that network list is used in a nested For Each Loop to read each network ID into a new table that is used later to iterate over just the tagged networks from all Organizations.
02-24-2026 02:36 AM
Thanks Ed,
I've tried to use the set variables method but I'm unable to use the variable to update in the new value field (see screenshot). any ideas?
02-24-2026 05:11 AM
@hoylandpaul When a variable is not selectable in the Browse Variables window, it is because of a Data Type mismatch.
I think you may be trying to assign a string to an array. There are some improvements planned for arrays, until then, the best way to do this is to use a string to collect all the sting values, and then use a Python activity to convert the string of strings into a proper array. Here's an example of a string where new string values are appended to it. Note that this does result in a leading comma, that is removed when the string is normalized into an array. If you need an example of that Python activity, let me know.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide