Trigger a Power Automate flow from Lightning Forms

You can use the HTTP Request action in the Action Builder to trigger a Power Automate flow.

Lightning Forms (and Lightning Tools Actions) include an Action Builder that allows you to create some fairly complex workflows. However, sometimes you need the "power" of Power Automate... for example to include other services than SharePoint or email, or to do things such as waiting for user actions. To trigger a Power Automate flow from Lightning Forms or Lightning Tools Actions, you can use the HTTP Request action. 

NOTE: This requires the Power Automate trigger called "When a HTTP request is received", which requires a premium ("Per Flow" or "Per User") Power Automate license.

Within your Power Automate flow, configure the trigger as follows:

mceclip2.png

We need to define the JSON schema to use for passing our parameters from the Lightning Form/Action action to Power Automate. The easiest way to do this is to use the "Use sample payload to generate schema" and set some example JSON, depending on the parameters you wish to pass to the Flow. It might be something like this, for example:

{

  "Title": "Our title",

  "ItemUrl": "https://someItemsUrl",

  "AssignedTo": "some email"

}

Microsoft Power Automate will then generate the JSON Schema for you.

After creating the rest of your Flow (or at least some next action) and saving it, copy the URL generated by Power Automate in the Request trigger:

mceclip4.png

Within the Lightning Forms/Actions Action Builder, configure a Send HTTP Request action as follows:

Request URL: Paste the URL we got from Power Automate

Request type: POST

Headers: Add a Request Header, where the Key is Content-Type, and the Value is application/json.

Data: Valid JSON that contains the values (placeholders) that we wish to pass to the Flow. Here's an example (include the JSON.stringify function):

=JSON.stringify({

"Title": [[Title]],

"ItemUrl": [[@Web.Url]]+"/Lists/FlowTest/DispForm.aspx?ID=[[ID]]",

"AssignedTo": [[AssignedTo]]

})

The configured action should look something like this:

After saving your Form or List Action, you should be able to trigger a Power Automate Flow from within the action sequence, passing parameters from your list item.

Published May 24, 2024