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

I’m struggling to solve a challenge with utilising data provided by ActiveCampaign API in my scenario.

I’m fetching data and values of all custom fields of an account (company) record on ActiveCampaign. The API returns an Array containing Collections which I then convert into Bundles with an Iterator module. (I’m not sure if this is the best approach, though.)

The original Collections / created bundles have identical data structures.

I would need to achieve the following:

  • Loop through the bundles created by the Iterator module (see the screenshot attached above). The amount of incoming bundles is always unknown.
  • Create variables based on the field ID found in the bundles. However, variables should be created based on certain field IDs only.

IF field ID is 1 ==> Save field value to VariableX.

Once variables have been set, the scenario flow should continue as one flow. Set variables will be used later.

I’ve tried different approaches with functions, the Router module etc. with no luck. One of these tests is in the screenshot below. Any ideas or tips on how to proceed?

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:


I created a “dummy custom field” for account records in ActiveCampaign and forced ActiveCampaign to save a value into this 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.


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.


Heya @AutomationMan :wave:

Fantastic job figuring this one out on your own! :clap:

Also, thank you so much for jumping back into this thread and sharing your MacGyver-like solution with the rest of the community. This is incredibly valuable and could be super helpful to many others looking for similar info. :pray:

FYI: I marked your comment as a solution to keep the community organized and easy to look for answers.