Forum Discussion

Youngmrr's avatar
Youngmrr
Copper Contributor
Aug 04, 2020
Solved

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 screensho...
  • RobElliott's avatar
    Aug 04, 2020

    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.

     

Resources