Using Power Automate Connector To Create Flows

In my previous article, I had explained how to create Localized Flow Templates and how the end-users can use the templates to create their own flows. However, many business users would want to have a very simple process of requesting a flow via a form. Something that they might have been familiar with while creating OOTB Approval Workflows in Classic SharePoint Sites. In this article, I will explain how we can automate the Flow creation process.

Pre-requisites

We will need a SharePoint List for End Users to capture inputs like Site URL, List URL, Approver Names, etc. We should also have a Base Flow available that would be created as a copy on other lists and libraries. For quick start and convenience, I have attached the Base Flow Template to this article.

Getting Started

Let’s get started with the steps to automate the flow creation process

  1. Navigate to Power Automate Designer here
  2. Create your own Approval Flow or Import the Base Flow package attached to this article

Now that the Base Flow has been created, we need another flow that can recreate this Flow on demand.

Step 1

Navigate to Power Automate Designer here.

Step 2

Go to “My Flows” and Create a New Flow from Blank.

Step 3

Use a manual trigger, so that the Flow can be executed on demand. You can replace the trigger as per your choice, I used a manual trigger in my example.

Step 4

Define the Input Parameters like Site URL & List Name which will need to be replaced on the Flow created from Base Flow.

Step 5

Initialize a few variables that will be needed later in the flow.

Step 6

Using the “Get Flow” action from Power Automate Connectors, configure the Flow that you would like to be created, in this example, we will use the “Base Flow”.

Step 7

Get all the connection references from the “Base Flow”.

Step 8

Replace the parameters like Site URL and List Name on the Flow Definition we get from the “Get Flow” action. The formula below for reference, update as per the flow,

  • Site URL - replace(string(outputs('Get_Base_Flow')?['body/properties/definition']),outputs('Get_Base_Flow')?['body/properties/definition/triggers/When_an_item_is_created_or_modified/inputs/parameters/dataset'],triggerBody()['text']) 
  • List Name - replace(variables('Site URL'),outputs('Get_Base_Flow')?['body/properties/definition/triggers/When_an_item_is_created_or_modified/inputs/parameters/table'],triggerBody()['text_1'])

Step 9

Finally, use the “Create Flow” action to create the flow from the updated definition.

Note
It has been observed that the Connection References in the “Create Flow” action will give an error if connections in the Base Flow are different from the user who is triggering the Button Flow to create copies.

Summary

This article describes how we can automate the process of creating the workflows from another flow. This approach can be extended to use a SharePoint List or PowerApps App as end-user input to create a flow that can be used as a reusable workflow by different users on their respective lists. I have attached flow sample files for your reference to kick-start this implementation. I hope that you enjoyed learning this new way of creating reusable workflows. Happy Learning!!