SOLVED

Button to update today's date in SharePoint list

Copper Contributor

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.

Youngmrr_2-1596519902511.png

 

I have been able to make a button. 

Can you guys help/advise please?

 

Thanks, 

Young

3 Replies
best response confirmed by Youngmrr (Copper Contributor)
Solution

@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. 

 

0-SP-list.png

 

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:

 

1-trigger-getItems.png

 

Next you need to update the item with today's date in the Date Reviewed column::

 

2-updateItem.png

 

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:

 

3-flowID.png

 

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.

 

@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

 

@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

1 best response

Accepted Solutions
best response confirmed by Youngmrr (Copper Contributor)
Solution

@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. 

 

0-SP-list.png

 

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:

 

1-trigger-getItems.png

 

Next you need to update the item with today's date in the Date Reviewed column::

 

2-updateItem.png

 

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:

 

3-flowID.png

 

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.

 

View solution in original post