Hello,
Hope everyone is well.
I am trying to create unique IDs with users' names and wondered, if the following solution is possible to accomplish with Power Automate?
1. User A is logged to a SharePoint site;
2. User A clicks Power Automate button in the SharePoint list to active the flow;
3. Power Automate recognizes that it was activated by User A and saves user's name and surname, for example.
Would sincerely appreciate an advice.
Solved! Go to Solution.
Hi @mantastg08876,
Just to validate. With activate you mean who triggered an existing flow on the list? If yes, this should be possible. You can get the user name of the identity which triggered the flow from the headers.
Below is a small example to demonstrate.
1. Create a flow with the SharePoint For a selected item trigger. Configure it to use a specific list, in this case Captureuser
2. Add a Compose action and add the following expression to it:
triggerOutputs()['headers']['x-ms-user-name']
3. Make a Note of your flow Id
4. Add a button to your list, in this case the CaptureUser list. Create a column called Button (type single line of text). Add the following json to it and replace the flow id by your flow id. This way you can click that button and trigger your flow.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"5086d422-c666-4840-bbb1-bb894fc59d20\"}"
},
"attributes": {
"class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
},
"style": {
"border": "none",
"background-color": "transparent",
"cursor": "pointer"
},
"children": [
{
"elmType": "span",
"attributes": {
"iconName": "PowerButton"
},
"style": {
"padding-right": "6px"
}
},
{
"elmType": "span",
"txtContent": ""
}
]
}
Hi @mantastg08876,
No, I mean the Response Headers from the trigger action in the Power Automate Flow. The flow is aware who triggered it.
You can extract that information from one of the properties of the Response Header, in this example either x-ms-user-name or x-ms-user-email.
Hi @mantastg08876,
Just to validate. With activate you mean who triggered an existing flow on the list? If yes, this should be possible. You can get the user name of the identity which triggered the flow from the headers.
Below is a small example to demonstrate.
1. Create a flow with the SharePoint For a selected item trigger. Configure it to use a specific list, in this case Captureuser
2. Add a Compose action and add the following expression to it:
triggerOutputs()['headers']['x-ms-user-name']
3. Make a Note of your flow Id
4. Add a button to your list, in this case the CaptureUser list. Create a column called Button (type single line of text). Add the following json to it and replace the flow id by your flow id. This way you can click that button and trigger your flow.
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "button",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"5086d422-c666-4840-bbb1-bb894fc59d20\"}"
},
"attributes": {
"class": "ms-fontColor-themePrimary ms-fontColor-themeDarker--hover"
},
"style": {
"border": "none",
"background-color": "transparent",
"cursor": "pointer"
},
"children": [
{
"elmType": "span",
"attributes": {
"iconName": "PowerButton"
},
"style": {
"padding-right": "6px"
}
},
{
"elmType": "span",
"txtContent": ""
}
]
}
Hi, @Expiscornovus.
many thanks for your elaborate response!
Regarding the "active" - yes, I meant "trigger":)
By the way. does a word "headers" mean "column headers" as shown in the screenshot below? If yes, would it mean that user name would have to written in the header?
Hi @mantastg08876,
No, I mean the Response Headers from the trigger action in the Power Automate Flow. The flow is aware who triggered it.
You can extract that information from one of the properties of the Response Header, in this example either x-ms-user-name or x-ms-user-email.
Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!
User | Count |
---|---|
15 | |
5 | |
4 | |
4 | |
4 |