Forum Discussion
Youngmrr
Aug 04, 2020Copper Contributor
Button to update today's date in SharePoint list
Hi all,
I am trying to make a button to update today's date column in SharePoint list.
So, if an user clicks a button then date column updates it today's date.
Please refer to the below screenshot.
I have been able to make a button.
Can you guys help/advise please?
Thanks,
Young
Youngmrr this can be done with a bit of JSON column formatting and a simple flow in Power Automate.
Your Confirm Reviewed column should be a single line of text. The Date Reviewed column is a date time column.
You format the Conform Reviewed column in advanced mode with the following JSON syntax:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "button", "txtContent": "Confirm Reviewed", "customRowAction": { "action": "executeFlow", "actionParams": "{\"id\": \"01f36bf6-d218-43b2-8c9c-f718b10f9fbf\"}" }, "style": { "background-color": "#c00000", "color": "white" } }
Later on you'll change the ID to your flow's ID.
Then in your flow the trigger is a SharePoint For a selected item. The first action is a SharePoint Get item to get the details of the item where you clicked the button:
Next you need to update the item with today's date in the Date Reviewed column::
Once you've saved your flow get the ID of it from the address batr, go back to the column formatting in your SharePoint list and replace the ID with the one you copied:
Clicking the button in the list will trigger the flow and add today's date into the Date Reviewed column.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.
- RobElliottSilver Contributor
Youngmrr this can be done with a bit of JSON column formatting and a simple flow in Power Automate.
Your Confirm Reviewed column should be a single line of text. The Date Reviewed column is a date time column.
You format the Conform Reviewed column in advanced mode with the following JSON syntax:
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "button", "txtContent": "Confirm Reviewed", "customRowAction": { "action": "executeFlow", "actionParams": "{\"id\": \"01f36bf6-d218-43b2-8c9c-f718b10f9fbf\"}" }, "style": { "background-color": "#c00000", "color": "white" } }
Later on you'll change the ID to your flow's ID.
Then in your flow the trigger is a SharePoint For a selected item. The first action is a SharePoint Get item to get the details of the item where you clicked the button:
Next you need to update the item with today's date in the Date Reviewed column::
Once you've saved your flow get the ID of it from the address batr, go back to the column formatting in your SharePoint list and replace the ID with the one you copied:
Clicking the button in the list will trigger the flow and add today's date into the Date Reviewed column.
Rob
Los Gallardos
Microsoft Power Automate Community Super User.
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.- YoungmrrCopper Contributor
RobElliott Hi Rob, thank you so much for your help. I have managed to execute a flow with a button.
Just quick question from this. How did you manage the pop-up screen after clicking a button, which is asking to run flow as attached?
Thanks,
Young
- RobElliottSilver Contributor
Youngmrr that is built in and you will get that every time. Although there are ways to adjust the text using JSON you can't remove the panel and the Run Flow button.
Rob
Los Gallardos
Microsoft Power Automate Community Super User