web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Change the color of a ...
Power Automate
Unanswered

Change the color of a button when clicked

(0) ShareShare
ReportReport
Posted on by 91

I have a workflow button in a sharepoint list.  I would like to add to the workflow that when this button is clicked change color.  can you please help me

Jenine1_1_0-1687229499811.png

Jenine1_1_1-1687229515095.png

 

 

 

 

Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Jenine1_1,

     

    You could potentially use column formatting for that. You just need to track that click or use another column value from the list/library.

    https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/formatting-syntax-reference#excel-style-expressions

     

    Below is an example with the Send Changes value.

     

     

    {
     "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
     "elmType": "button",
     "customRowAction": {
     "action": "executeFlow",
     "actionParams": "{\"id\": \"yourflowguid\"}"
     },
     "attributes": {
     "class": "=if([$SendChanges] == 'Email changes made', 'ms-fontColor-red ms-fontColor-themeDarker--hover', 'ms-fontColor-themePrimary ms-fontColor-themeDarker--hover')"
     },
     "style": {
     "border": "none",
     "background-color": "transparent",
     "cursor": "pointer"
     },
     "children": [
     {
     "elmType": "span",
     "attributes": {
     "iconName": "Flow"
     },
     "style": {
     "padding-right": "6px"
     }
     },
     {
     "elmType": "span",
     "txtContent": "Send to Manager"
     }
     ]
    }

     

     

    colourred_test.png

  • Jenine1_1 Profile Picture
    91 on at

    thank you so much for this, i did what you suggested, but it didnt change the color,  this is what i have, can you please let me know what i did wrong,  I am very new to Json

     

    {
    "elmType": "Button",
    "txtContent": "Send for QA",
    "customRowAction": {
    "action": "executeFlow",
    "actionParams": "{\"id\": \"xxxxxxxxxxxxxxxxxxxxxx\"}"
    },
    "attributes": {
    "class": "=if([$SendChanges] == 'Email changes made', 'ms-fontColor-red ms-fontColor-themeDarker--hover', 'ms-fontColor-themePrimary ms-fontColor-themeDarker--hover')"
    },
    "style": {
    "border": "none",
    "cursor": "pointer",
    "background-color": "transparent"
    },
    "children": [
    {
    "elmType": "span",
    "attributes": {
    "iconName": "Flow"
    },
    "style": {
    "padding-right": "4px"
    }
    },
    {
    "elmType": "span",
    "txtContent": "Send for QA"
    }
    ]
    }
  • Verified answer
    Expiscornovus Profile Picture
    33,189 Most Valuable Professional on at

    Hi @Jenine1_1,

     

    In that if statement you need to use the internalname of the Send Changes column. I assumed that internal name of the field was SendChanges, but might be different in your setup. Can you double check?

     

    You can check in the list/library settings. Also see method 1 in @ekarim2020 his nice blog about internal names:

    https://elliskarim.com/2021/12/20/finding-the-internal-name-of-a-sharepoint-column/

     

    The example I shared only shows a red colour when the 'Email changes made' text value is in the Send Changes column. A row with an empty value would not change colour after clicking. You would still have to update that Send Changes column with that text from within your flow.

     

    Again it was just an example to demonstrate such an approach.

  • Jenine1_1 Profile Picture
    91 on at

    Thank you for that.  I understand now.   Much appreciated for your time and help.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard