How to run the same flow for two (or more) sets of variables

apps

Member
Please check this screenshot. So what I would like to do is I am running a flow I need to run twice - and the only difference between these two runs are two variables

Company ID in accounting program (GET)
And subfolder I upload invoices to (POST)

Basically I get invoices from company A
And I post the invoices in a Company A folder
And I rerun the same just with company B

I realize I can duplicate my entire flow and just change those two variables. However that's quite inefficient and it's not very practical for easy maintenance.

So I wonder can I in the beginning of my flow define those two variables and then have an iterator that first runs the entire flow using the first set of variables and then afterwards reruns the same flow using the different set of variables.
1753275458288.png
 

ArshilAhmad

Well-known member
Staff member
Hi @apps,

To achieve this use case, you would need to add a Router to your workflow with two routes. Both routes should have the same filter conditions. Then, add the steps related to Company A in Route 1 and the steps related to Company B in Route 2. Essentially, both routes will execute each time the workflow is triggered.
 

apps

Member
No that still means I have to duplicate all steps among 2 router paths. It's this I want to avoid. Because if I need to change on thing I have to redo my changes in both routers. That is the issue.

Can't I use an iterator to run all steps after with 2 different sets of variables? Only having the flow once.
 

ArshilAhmad

Well-known member
Staff member
Here, we have passed an array into the Text Formatter, and then passed the result to the Iterator.

Similarly, you can add your company IDs as array objects and pass them to the Iterator.

 

apps

Member
Hi ArshilAhmad,
Thanks, this is exactly what I meant! However I have have two sets of variables - not just 1 set.

I need it like this:

Run 1:
- apikey = abc
- subfolder id = 123

Run 2:
- apikey = xyz
- subfolder id = 741

How can this be accomplished?
 

apps

Member
Ahhh awesome thanks ArshilAhmad! It looks like something like this could work! And I see how I can add multiple variables as well. Will implement and will let you know if I have any problems!

Thanks again!
 

apps

Member
Hi ArshilAhmad,
I have to return again and say this solution is working perfectly! Really this has so many usecases. I can really simplify many of my flows based on this! Makes maintenance so much easier for all my Pabbly flows! Thanks so much!
 

ArshilAhmad

Well-known member
Staff member
Hi ArshilAhmad,
I have to return again and say this solution is working perfectly! Really this has so many usecases. I can really simplify many of my flows based on this! Makes maintenance so much easier for all my Pabbly flows! Thanks so much!
Thank you for the update. Glad we were able to help.
 
Top