Triggering a Power Automate flow from a Power Canvas App and receiving the result back is a fantastic way to enhance your app’s functionality. Below, I’ve provided step-by-step instructions on how to trigger a Power Automate flow from a Power Canvas App and return a collection within the app.
In this example, we’ll create a simple Power Automate flow that will be triggered from the Power Canvas App and return a collection of SharePoint list attachments to the app.
Step 1:
Build PA flow triggered from and response to Power Apps Canvas App
- Select trigger from Power Apps (V2) > Add itemID as an input (Type: Integer).
- Add action Get item > then action Get attachments.
- Add the action Response to a Power App or flow > Add Text input > name it as Result and enter the output from above step.
- Detail configuration as follows.
Step 2:
Create a collection of item attachments by calling the above PA flow and pass itemID from Power Apps Canvas App
- Create a new Button in Power Canvas App.
- Add below function for the OnSelect property:
ClearCollect(
col_your_collection_name,
ForAll(
Table(ParseJSON( GetAttachmentsofSharepointListItem.Run(your_itemID).result )),
{
Id: Text(Value.Id),
AbsoluteUri: Text(Value.AbsoluteUri),
DisplayName: Text(Value.DisplayName),
'@odata.type': Text(Value.'@odata.type')
}
)
)
Last but not least, note that I am not focused on the basics, so if you need further assistance, feel free to let me know.