Sharepoint Button

New Contributor

Hello Everyone,

I would like to create a button in SharePoint that, when pressed, enters the following in two other columns, by whom the button was pressed and when this button was pressed. My question is now how I can best implement this or if someone can already show a solution for this.

I thank you

2 Replies

@Tison5 you can do this with a simple flow in Power Automate and a JSON-formatted button.

 

First, create your columns in the list. In my example I have:

ButtonSingle line of text
PressedYes/No
PressedByPerson
PressedOnDate/Time including the time

 

Next create an instant cloud flow in Power Automate use the SharePoint "for a selected item" trigger.

1-Flow.png

 

The first item needs to be the SharePoint "get item" and you select ID from the dynamic box that appears when you click in the Id field.

 

2-Flow.png

 

Finally, add a SharePoint "update item" action.  Select ID and Title (if it's a required column) then for the Pressed column select Yes from the dropdown. For the PressedBy column select Modified By Claims. For the PressedOn column click in the field and when the dynamic content box appears chosse the Expression tab and enter the expression utcNow() and press OK.

3-Flow.png

 

In the top left of your flow change the name to something relevant. Click Save in the top right of the flow. Then click the left arrow in the top left of the flow to go to the flow's main screen.

 

Next copy the ID of the flow:

4-FlowID.png

 

Next, format your Button column:

5-FormatColumn.png

 

and go to the Advanced mode screen:

 

6-AdvancedMode.png

 

Copy & paste the following JSON code, changing the text you want in the button (the txtContent line) and making sure that in the actionParams line you change the flow ID to yours. You can also style the button with css:

 

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "Press this button",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"70bcc1be-c1af-436c-94a6-50828b1582ef\"}"
  },
  "style": {
    "background-color": "#460302",
    "color": "#ffffff"
  }
}

 

 

 

Save it. When you click the button the flow will trigger and put in the data into the columns:

7-SP-List.png

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver) 

 

@RobElliott thank you very much this really helps me