If (you know) you are going to repeat some steps of the Flow logic (actions, conditions etc) in multiple Flows for different triggers and entities, think about using a child Flow as a container for a reusable logic. Although you can always clone your Flow via Export-Import, making changes to a single module is much easier than to manually repeat it multiple times in different places. There are more chance to make a mistake and/or to not being able to track what’s changed and where.
In my previous post I created the Flow to combine Tags in a long string to a store it in a custom text field.
Now I would like to extract the logic on the left-hand side into a separate Flow then call that Flow from the parent.
The solution is to trigger a child Flow on Request from a parent Flow. In the request I will pass the parameters required to perform all necessary steps.
After looking closely to the left side of my Flow, I realised 3 things:
- I’ve created the action, which is not required, Get record;
- I could easily move the logic into a child Flow;
- I have to pass only one parameter to my child Flow from the parent.
I use Export/Import to create a copy of the Flow. Then I move “Initialise Description variable” action inside the child Flow, because it make sense.
Step 1. Trigger on Request
I use a sample payload to generate the schema: {“entitytype”:”account”,”entityid”:”4fd004f7-d3d0-457b-9dcf-ef95da338111″}.
“HTTP POST URL” will be generated on Save of the Flow.
Step 2. Initialise the Description variable.
Step 3. Getting PowerHashTag Connections for the Account.
I use the parameter entityid passed from the parent Flow to for the Filter Query.
Step 4. For each PowerHashTag Connection from Step 3 query PowerHashTag then append its Name to the Description.
Step 5. Update the Account with the Description.
The entityid parameter passed from the parent Flow is required to update the Account record Tags field.
Whole Flow looks like this:
Going back to the parent Flow… I remove the logic block, it’s not required anymore. I use the HTTP call of the child Flow instead:
On the left-hand side, I’ve got a HTTP call to the child Flow, where “URI” refers to the Step 1. “HTTP POST URL” and “Body” contains the JSON in the format defined in the child Flow.
I had no issues. It just works.
In my case I tried to solve the problem but it’s more complex than I expected it to be. I will tell you about its next time.