cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
emmahuynh
Helper II
Helper II

Update Button when Clicked in SP List Item

I have a button in SP list item. when user clicks on "Send for Approval" button, it triggers the event to run Flow and send email to others. I want to update the button from " Send for Approval" to "Request Sent" when user clicks the button. That case, we will know which rows the user sent email to others and which rows the user hasn't sent email.

basically, could be an else if condition: If user clicks the button => change to "Request Sent" else 'keep the text the same as Send for Approval'

emmahuynh_0-1614892899661.png

here is the code in JSON for this column. 

{
"elmType": "button",
"txtContent": "Send for Approval",
"customRowAction": {
"action": "executeFlow",
"actionParams": "{\"id\": \"3bd8a3d9-311c-46ec-9c09-a2ccc2a62b8a\"}"
},
"style": {
"background-color": "#468259",
"color": "white"
}
}
Thank you
 
1 ACCEPTED SOLUTION

Accepted Solutions
Expiscornovus
Super User
Super User

Hi @emmahuynh,

 

In addition to @ChristianAbata his approach you can also amend the current column formatting example and use a operator to set the visibility.

 

Below is an example of that.

 

This does require the creation of an additional choice column (Button Request Status) with the values Send for Approval and Request Sent. However, you can hide that column from your view.

 

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "Send for Approval",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"3bd8a3d9-311c-46ec-9c09-a2ccc2a62b8a\"}"
  },
  "style": {
    "background-color": "#468259",
    "color": "white",
    "visibility": {
      "operator": "?",
      "operands": [
        {
          "operator": "==",
          "operands": [
            "[$ButtonRequestStatus]",
            "Send for Approval"
          ]
        },
        "visible",
        "hidden"
      ]
    }
  }
}

 

 

buttonrequeststatus.png

 

Within the flow setup you can use an update item to set Button Request Status to Request Sent. This will make sure that the button is hidden.

requestsent.png

View solution in original post

2 REPLIES 2
ChristianAbata
Super User
Super User

hi @emmahuynh  I think you need a cannvas app



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA
Expiscornovus
Super User
Super User

Hi @emmahuynh,

 

In addition to @ChristianAbata his approach you can also amend the current column formatting example and use a operator to set the visibility.

 

Below is an example of that.

 

This does require the creation of an additional choice column (Button Request Status) with the values Send for Approval and Request Sent. However, you can hide that column from your view.

 

 

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
  "elmType": "button",
  "txtContent": "Send for Approval",
  "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"3bd8a3d9-311c-46ec-9c09-a2ccc2a62b8a\"}"
  },
  "style": {
    "background-color": "#468259",
    "color": "white",
    "visibility": {
      "operator": "?",
      "operands": [
        {
          "operator": "==",
          "operands": [
            "[$ButtonRequestStatus]",
            "Send for Approval"
          ]
        },
        "visible",
        "hidden"
      ]
    }
  }
}

 

 

buttonrequeststatus.png

 

Within the flow setup you can use an update item to set Button Request Status to Request Sent. This will make sure that the button is hidden.

requestsent.png

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events happening this month - don't miss out!

 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (3,273)