I am looking for a method how to create a flow automatically from an existing one, I found that there is some Power Automate action like (Get flow, Create flow ... etc) and I believe Create flow will serve me like I want.

My question now, I tried the following flow: enter image description here

  • Well, the first action Get Flow it returns the following proprieties for a selected flow:

    1. Display name
    2. Flow Definition
    3. Flow State
    4. ConnectionReferences
    5. triggers
    6. actions

-Now in order to create the flow from the one i just recover from the previous action enter image description here

it seems too easy heh? when I run the flow, the first action Get Flow will work perfectly and return the informations of the selected flow, while the action Create Flow will keep executing until the flow get failed enter image description here

So i tried to copy Flow Definition from Flow Run History and paste it in the Flow Definition field, then when i click in Save the following error appear:

Correct to include a valid reference to 'Send_an_HTTP_request_to_SharePoint' for the input parameter(s) of action 'Create_Flow'.

and here is the json of this action !

"Send_an_HTTP_request_to_SharePoint": {
        "runAfter": {},
        "metadata": {
          "flowSystemMetadata": {
            "swaggerOperationId": "HttpRequest"
        "type": "ApiConnection",
        "inputs": {
          "host": {
            "connection": {
              "name": "@parameters('$connections')['shared_sharepointonline']['connectionId']"
          "method": "post",
          "body": {
            "method": "GET",
            "uri": "_api/web/sitegroups(5)/users",
            "headers": {
              "Accept": "application/json;odata=verbose",
              "Content-Type": "application/json;odata=verbose"
          "path": "/datasets/@{encodeURIComponent(encodeURIComponent('https://m365x873105.sharepoint.com/sites/BBS-support'))}/httprequest",
          "authentication": "@parameters('$authentication')"
  • Are there Automate actions that let you Get and Create an API Connection? Normally, if you are provisioning a Flow entirely programmatically by manually crafting your JSON, you would have to define an API Connection outside the definition of the Flow before you could reference it in an action inside the Flow. BUT, when you build it entirely in the Automate UI in the browser, it auto-generates your API Connection behind the scenes when you create an action that needs it. Using your "Flow to create a Flow" seems like it is somewhere between manual JSON and the UI-method.
    – willman
    Commented Jan 5, 2020 at 21:51
  • I couldn't get your point, could you explain more Commented Jan 6, 2020 at 10:32
  • 1
    In the code of the Action you posted, it makes use of a saved connection named "shared_sharepointonline". But this is the code for just this one action. If you viewed the full JSON code of the entire Flow, you would see the full detailed definition of that named connection. If you were building this Flow in the visual designer, you normally don't have to worry about creating a connection and then referring to it, the designer just creates the connection definition when you first add an action like Send_an_HTTP_request_to_SharePoint.
    – willman
    Commented Jan 6, 2020 at 12:57
  • 1
    But since you are using a Flow to create another Flow, you don't have the benefit of the things the UI Designer does for you automatically, so you will need to add steps to this Create a connection definition for the new Flow you are generating, or some way to pass in credentials to the new Flow definition.
    – willman
    Commented Jan 6, 2020 at 12:58
  • Indeed, I understand now, so I should look how to manage again the connection in the new created flow Commented Jan 6, 2020 at 16:46


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.