Power Automate – Reusable Logic Across Flows

4 min read

There are instances where you may want to use common logic across multiple Flows, like some data manipulation logic, or an instance where you want your Flow to have multiple triggers which are not yet possible, but you can create two flows with two different triggers and call third flow which implements your processing logic. So, wherein this blog post I will show you one of the ways to use common logic across Flows. 

If you have read my previous there is common logic, I used to remove special characters from a text, so I will use this as an example in this post. I have multiple flows that use this logic, though it is just 3-4 actions used to implement this logic, but it could save time, effort, increase the maintainability of Flows. 

Please note this approach uses HTTP Connector trigger and actions in the Flow which are premium connectors, so you will need an appropriate license to use these HTTP connectors. 


Now we will do the following: 

  1. Create one Flow which has shared logic
  2. Create a second Flow from which we will use the Flow created in Step #1 



New call-to-action

Step #1: Create a Flow which has commonly shared logic 

  1. To create the Flow, Go to Power Automate -> Create -> Start from Blank -> Instant Flow
  2. Provide an appropriate name for the Flow, select “When an HTTP request is received” and click on Create button. 


Power Automate – Reusable logic across Flows

3. For “When an HTTP request is received” trigger we need JSON for the request body. Our input parameter will be a text which we need to process. Click on “Generate from sample” button and paste the below JSON and click on the Done button.


4. Initialize a variable ‘OutputText’ and assign it the ‘texttomanipulate’ value from Dynamic Content 

5. To replace special characters and spaces from Title value to get the Site URL, create an Array using the Compose action 


Use following expression: 

createArray(' ',':','#','%','"','"','*','?','/','\','|','<','>','{','}','(',')','$','@') 


a. In an Apply to Each loop, replace special characters from Subject. Use the output from the previous step, i.e. the previous compose Action output 

b. Compose – Replace Special Characters 

Use the expression: replace(variables(‘OutputText’),item(),”) 

c. Set Variable – Save the output of replacing special characters to variable 

6. Now we have the text with special characters removed and we would want to return this text back so that another Flow which is using this text manipulation Flow, gets the return value. So, here we will use the action “Respond to a PowerApp or Flow”; add this action to your flow.  


7. Now click on “Add an Output” button and choose the type of output as Text 

8. Provide the Title and value as ‘OutputText’ 

9. Save the Flow and you are done with this Flow now. 

 10. Copy the HTTP Post URL from the “When an HTTP request is received” trigger and paste it in notepad, you will need it later. 

Step #2: Create a Flow will use the common logic in the Flow created in Step #1 

 In Step #1 we created a Flow which can be used on other Flow, now to demonstrate how it can be used in other Flows we will create a new Flow which will use the Flow created in the Step #1 

  1. To create the Flow, Go to Power Automate -> Create -> Start from Blank -> Any type of Flow
  2. Provide an appropriate name for the Flow and select the trigger that you may want to use
  3. Add HTTP Action to call another Flow and configure it properties as follows: 


a. Select Method as “POST 

b. For URI, paste the HTTP Post URL that you copied during Step #1 Flow, point #10 

c. Body: Paste the following JSON, please “<Any Input Text>” with your text or variable in your Flow: 


  "texttomanipulate": "<Any Input Text>" 


4. Now add the Parse JSON” action to get the return value of the request sent to another Flow a. Select Body in the Content property 

b. Click on “Generate from a sample” and paste below JSON 

{ "OutputText": "Test" } 

5. Now add “Set Variable” or “Initialize Variable” Action to store the value returned from the HTTP Request. Select the value as “OutputText” from the Parse JSON action dynamic content. 

6. Further, you can use this variable in your Flow and perform further actions as per the business logic in your Flow.

So to conclude we create two Flows in this post, first Flows which contains the reusable logic which you can use in multiple Flows, the second Flow is just to show the example of how you can call other Flows and how to process the response of that Flow.

Recent Posts