cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dhubach1
Frequent Visitor

Changing Button Color Based on value in Form

Hello Everyone.

 

I was wondering (if possible) If I could change a buttons fill color based on the "Status" of the request. My PA is connected to SPO and it is a expense request app. After the user puts in a request it is automatically set to "Pending". I have a "recent order" screen where the users can view their past submissions. At the moment I have it set up as a gallery using buttons to give it a rounded feel. I would like the button fill to change to green if accepted and red if declined. If there is a better way to display past orders I am definitely open to hear any suggestions.

 

Dhubach1_0-1637068275233.png

Dhubach1_1-1637068330651.png

 

I would like it to be dynamically switched based on the status value. Should I use If statement?

 

Please let me know if you need any other info or screenshots.

 

Thanks!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
AmDev
Super User
Super User

Hi @Dhubach1 

 

You could use If, but I would recommend a Switch statement in your fill property as follows:

 

Switch(ThisItem.Status, "Pending", Blue, "Approved", Green, "Declined", Red )

 

If your status column is a choice field you need '.Value' after Status.

 

Hope this helps - Good luck

View solution in original post

3 REPLIES 3
AmDev
Super User
Super User

Hi @Dhubach1 

 

You could use If, but I would recommend a Switch statement in your fill property as follows:

 

Switch(ThisItem.Status, "Pending", Blue, "Approved", Green, "Declined", Red )

 

If your status column is a choice field you need '.Value' after Status.

 

Hope this helps - Good luck

Dhubach1
Frequent Visitor

Worked! Thanks very much!!

AmDev
Super User
Super User

No probs. Glad you got sorted

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (3,293)