Looping through Collections or Bundles to create variables [SOLVED with duct tape 😅]

Ok, so I solved my issue with a dirty duct tape solution. I’ll share it here in case this helps anyone. Feel free to judge me. :smile:

Solution:

I created a “dummy custom field” for account records in ActiveCampaign and forced ActiveCampaign to save a value into this dummy field.

dummy-field

I get all the data and values of a single ActiveCampaign account through an API call which is then processed by an Iterator module.

The dummy field on the ActiveCampaign account ensures that the original API call return is never empty since there’s always at least one custom field with a value. (ActiveCampaign’s API returns only the custom fields of an account record with saved values.)

I used the Router module to separate different custom fields from the bundles created by the Iterator to save them as variables.

I also used my dummy field to mark a situation where “all variables needed from the original API call have been saved and the scenario flow should continue along one main path”.

The filtered “dummy router path” is always the last one executed. It continues to the rest of the flow.

router-filter-example

Note that this dummy field should always be the last of the bundles created by the Iterator for this to work. Lucky me, ActiveCampaign API returns the list of custom fields in the order of field IDs so as long as the dummy field’s ID is the highest number, it works fine.

The fallback route of the Router is reserved for all the rest of the customs fields potentially coming in through the API, but which are unnecessary for the scenario flow.