So far, we have discussed how we can pass canvas app chart values to flow and generate a printable HTML in SharePoint. I highly recommend that you read my previous post to understand the context.
Now, our challenge today is to create a button action that can access the SharePoint document within the PowerApps.
Here are the steps:
- Pass SharePoint document link to the canvas app using flow
a. Add a new screen to the app(ReportDownloadScreen) : Success Screen
b. Add below line to the “Generate Chart” button OnSelect code.
c. Now, go to actions> PowerAutomate, select the flow and edit.
Add below “Initialize variable” actions
This will give us the ability to change the SharePoint location and filename without having to edit SharePoint connector.
d. Create file SharePoint action should be configured with new variables.
e. Now, we need to create the document link. We can use “Set variable” action for this.
SharePoint document link will be assigned to the “SP Link” variable.
f. Now add a text field(downloadlink) in the “Respond to a PowerApp or a flow” action and assigned the SP Link value to it.
g. Save and close the flow.
2. Add this link as a download action in PowerApps
a. Go to canvas app and open ReportDownloadScreen.
b. Add a button (Download Report)
c. Since we are passing the downloadlink from flow, we can access it inside the canvas app using flowresult object.
For the download button OnSelect value, enter below:
All set! Now let’s test this app..
You can create different types of HTML pages, add visuals and update UI of this app to meet your business requirements. My advice is “If it doesn’t work the first time, keep on trying until you get it right”.
Here is the complete app for your reference, you can import the solution and start exploring the design. You can reach out to me if you have any questions.