Forum Discussion
Gareth Jayne
Jan 11, 2019Copper Contributor
Flow button in Modern Document Library Web Part
Hi everyone I am working on a modern Team Site. I have followed the instructions here to create a button in a document library to run a flow on a specific document, and this works perfectly in t...
Jan 11, 2019
So the list webpart supports column formatting, so I would assume so does the Document library webpart. Look into adding a button using that.
https://wonderlaura.com/2018/07/18/button-in-sharepoint-list-to-trigger-microsoft-flow/
https://wonderlaura.com/2018/07/18/button-in-sharepoint-list-to-trigger-microsoft-flow/
Gareth Jayne
Jan 11, 2019Copper Contributor
Thanks for the reply.
The link you posted is what I used when creating my button and I can create one in both a list and library. The button also shows up when viewing the list/library in a web part on a page but my problem is if I click the button on the web part it does nothing, where if I click it directly in the list or library it fires.
I wondered if it's possible to get a Flow to fire on-demand like this using a list or library web part. I assume it's not as you don't get the context menu options to do anything with flows in the web parts?
- Jan 11, 2019Oh, I see what you mean, so you do get the view to show correctly in the webpart on the page, it just doesn't fire for whatever reason like it does in the view if you go into the library itself? Like you said there must be some context link there in the URL that it uses and probably how it renders the item / URL with the column formatting. Can you paste the section of the button so I can see what the URL it's calling looks like when clicking the button?
- Gareth JayneJan 11, 2019Copper Contributor
Thanks Chris.
The formatting for the button action section is below:
"txtContent": "Run Flow",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"3d12dc3e-7d64-4e77-8dd2-876348cb187b\"}"
}The corresponding HTML is:
<button tabindex="0" style="border:none;background-color:transparent;color:#0078d7;cursor:pointer;" data-actionparams='{"id": "3d12dc3e-7d64-4e77-8dd2-876348cb187b"}' data-actionname="executeFlow" data-iscustomformatter="true">Run Flow</button>
- Jan 11, 2019So I'm thinking, if you can add hard code the rest of the site URL where the flow's exist. Then that should pass to the page you are using the webparts and should be able to file in that context. So instead of just \id\09250932r3 you could figure out where that id is in the URL and have the whole URL there, so https://tenant.sharepoint.com/sites/_whatever/id/flowidhere etc. Cause right now I think it's just kind of adding on to the existing URL of the page your on, and since you're on a different page with parts need to get that hard coded in.. Make sense?