#PowerPlatformTip 169: 'Run a For-a-Selected-Item Flow from Any List with a Column Button'
TL;DR: The SharePoint Automate menu only lists For a selected item flows from the Default environment, which many companies forbid for productive flows. Instead of switching to the premium HTTP trigger, keep the standard For a selected item trigger in your productive environment and start it from a column-formatting button with
customRowAction: executeFlow. The flow receives anentity(ID,itemUrl,fileName) and the request headers (who clicked), so one flow can serve several lists. Share it with run-only users so colleagues can click the button.
For a selected item is the classic way to let users pick a row and start a flow. But for this trigger, the Automate menu in SharePoint only lists flows from the Default environment. Many organizations lock Default down, so the moment you move the flow to a productive environment the menu entry vanishes. You could rebuild it with a When an HTTP request is received trigger, but that’s a premium connector. The better answer: keep the trigger and launch it yourself from a column button.
💡 Challenge
Once the flow lives outside Default, the native Automate menu no longer offers it. You still want a “click a button on this row” experience, without the premium HTTP trigger, and ideally with one flow across lists instead of a copy per list.
✅ Solution
Two things make this work:
🔸 Launch it from a column button. SharePoint column formatting supports customRowAction with executeFlow, which starts a specific flow by its ID for the current row. The flow doesn’t have to appear in the Automate menu for that.
🔸 Read the real context at runtime. The trigger passes the clicked item in its entity output. Use ID and itemUrl from there to read the item, so the flow doesn’t depend on the site and list you picked in the trigger.
A run started from a document library returns, for example:
1
2
3
4
5
6
7
8
9
10
{
"body": {
"entity": {
"ID": 141,
"itemUrl": "https://contoso.sharepoint.com/sites/Projects/Shared Documents/Offer.docx",
"fileName": "Offer.docx",
"FileId": "141"
}
}
}
🔧 How It’s Done
1. Build the flow with the For a selected item trigger.
🔸 Create an instant flow with For a selected item (lists) or For a selected file (libraries) in the environment where it belongs.
🔸 Select a Site Address and List in the trigger; the flow needs a valid selection to save.
2. Read the item context from entity.
🔸 The item ID:
1
triggerBody()?['entity']?['ID']
🔸 The site URL from itemUrl. Split on the segment that follows the site: for a list that is /Lists/, for a library the library’s URL name, for example /Shared Documents:
1
first(split(triggerBody()?['entity']?['itemUrl'], '/Lists/'))
1
first(split(triggerBody()?['entity']?['itemUrl'], '/Shared Documents'))
🔸 Call Get item (lists) or Get file properties (libraries) with the derived site, your list or library and the ID, and read every other field from there.
🔸 If the flow serves several lists, put Site Address and List Name of Get item on the dynamic values, for example from a small configuration list keyed by site.
🔸 Who clicked is in the request headers:
1
triggerOutputs()?['headers']?['x-ms-user-email']
3. Get the flow ID for the button.
🔸 Open the flow in Power Automate and select Export > Get flow identifier. For a flow in a solution, open it from the Solutions area first. Copy the ID.
🔸 Alternatively, assemble it from the address bar of the flow in your productive environment. The ID format used here is v1/<environment-id>/<flow-guid>:
1
https://make.powerautomate.com/environments/11111111-2222-3333-4444-555555555555/flows/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee/details
🔸 Environment ID = the value after /environments/: 11111111-2222-3333-4444-555555555555. If the address shows a Default- prefix, leave it out.
🔸 Flow GUID = the value after /flows/: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee.
🔸 Assembled: v1/11111111-2222-3333-4444-555555555555/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee.
4. Add a button column with customRowAction: executeFlow.
🔸 Create a column (for example single line of text) named Run, open Column settings > Format this column > Advanced mode, and paste:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"txtContent": "▶ Run",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\":\"v1/11111111-2222-3333-4444-555555555555/aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee\", \"headerText\":\"Start process\", \"runFlowButtonText\":\"Run\"}"
},
"style": {
"border": "none",
"background-color": "#2dd4bf",
"color": "white",
"padding": "4px 10px",
"border-radius": "4px",
"cursor": "pointer"
}
}
🔸 Replace the id with your value from step 3. headerText and runFlowButtonText are optional and set the texts of the flow panel.
5. Give users run-only access.
🔸 On the flow’s details page, open Run only users > Edit and add the users or a group.
🔸 Decide per connection: Provided by run-only user (the flow acts with the clicking user’s permissions) or the connection already defined in the flow.
🔸 Without run-only access the button does nothing for that user, because they aren’t allowed to run the flow.
6. Test it.
🔸 Click ▶ Run on a row. For a solution-aware flow the flow panel opens and you select Run flow, a flow outside a solution runs right away. The run history shows the entity with the clicked row’s ID and itemUrl.
🔸 Paste the same JSON on another list to reuse the flow there.
🎉 Result
Users keep the familiar per-row button, but the flow lives wherever governance requires it, with a standard trigger, and the run knows which item was clicked and by whom.
🌟 Key Advantages
🔸 No premium: For a selected item is a standard trigger, unlike When an HTTP request is received.
🔸 Independent of the Automate menu: the button starts the flow by ID, in any environment.
🔸 One flow, many lists: entity carries the real item, dynamic Get item values do the rest.
🔸 Caller included: the header tells you who clicked (x-ms-user-email).
🔸 Native feel: a real per-row button inside the list.
🛠️ FAQ
1. Does the Site Address I pick in the trigger really not matter?
The trigger needs a valid selection to save. The data of the run comes from entity, so as long as you read the item with the site and ID derived from entity, the flow works on the row that was clicked.
2. How do I turn itemUrl into a usable Site Address for Get item?
Split itemUrl on the segment after the site, /Lists/ for lists or the library URL name such as /Shared Documents for libraries, and take the first part. Then use Get item or Get file properties with that site, the list name and the ID.
3. Why does the button do nothing for some users?
They have no permission to run the flow. Add them under Run only users. The column button shows for everyone who can see the list, it doesn’t hide itself for users without access.
4. Does this also work for documents?
Yes, use For a selected file and Get file properties. You get ID, FileId, fileName and itemUrl in entity.
5. Why not just use the When an HTTP request is received trigger?
That trigger is premium. For a selected item is standard, so the column-button approach keeps the solution premium-free while still giving you the row (entity) and the caller (header).
6. Can I keep the flow in Default as a governed exception instead?
Yes. If it’s just a few low-risk helpers, keeping them in Default as documented exceptions (service-account owner, DLP-scoped) is a valid alternative to the column-button redesign.
🔗 Related Tips
- #PowerPlatformTip 135: One Flow, Many Users, one flow as a shared trigger hub for the whole company.
- #PowerPlatformTip 34: PowerApps V2, typed inputs and a service-user connection for reusable, governed flows.
- #PowerPlatformTip 21: Use Triggeroutput, read request/header data to identify and notify the caller.
This tip is by Marcel Lehmann, Microsoft MVP (Business Applications) and founder of the Power Platform Academy – live Power Platform workshops, free or CHF 49. Join the workshop waitlist to get notified about new dates. For companies that want this implemented for them, see KMUpower – Power Platform consulting & automation for SMEs (DACH).