cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
onyebuchiboss
Helper III
Helper III

Show/hide a button in the ribbon using power Fx

Hello All,

What I am trying to do is really basic but for some reason, I have been stuck in this for days now. 

How do I have a button in the ribbon of a model-driven app using Power FX? I have the below code, but it does not seem to work:

 

 

If(And(IsBlank(Self.Selected.Item.'Created On'),Or(Text(Self.Selected.Item.'Status Reason') = "100000008", Text(Self.Selected.Item.'Status Reason') = "100000004"),false,true)

 

 

I am trying to hide if the created On field is blank and my status is equal to any of the above 2 values, but the button is always present even when the status is equal to any of the above.

 

Someone, please help. The status is an optionset/choices.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
SBax
Impactful Individual
Impactful Individual

Here is an example of a similar (albiet simpler approach I have used in the past

 

If(Self.Selected.Item.'Reservation Status' = 'Reservation Status (Stage Gate Approval Slot Reservations)'.Cancelled,false,true)
 
 
This approach will check if the Reservation Status field on a table called Stage Gate Approval Slot Reservations is Cancelled, if it is hide the button, otherwise show it
 
I would suggest trying to replicate the above with one of your status reasons to see if the rule is working, before adding in the OR condition and the IsBlank later

View solution in original post

16 REPLIES 16
SBax
Impactful Individual
Impactful Individual

You don't need the text() parts, and you should refer to the status fields using the following syntax 

 

 'Status Reason' (Table).Value

 

e.g. 'Status Reason' (Account).Active

 

Give that a try and let me know if you have any issues

onyebuchiboss_1-1660166533352.png

As you see above, the red error line - "Invalid argument type (OptionSetValue). Expecting a Boolean value instead.". I have removed the integer value in quotes, still same thing

SBax
Impactful Individual
Impactful Individual

Here is an example of a similar (albiet simpler approach I have used in the past

 

If(Self.Selected.Item.'Reservation Status' = 'Reservation Status (Stage Gate Approval Slot Reservations)'.Cancelled,false,true)
 
 
This approach will check if the Reservation Status field on a table called Stage Gate Approval Slot Reservations is Cancelled, if it is hide the button, otherwise show it
 
I would suggest trying to replicate the above with one of your status reasons to see if the rule is working, before adding in the OR condition and the IsBlank later

Thanks for responding. I am having a problem where I am not seeing all the options for my status. Look at the image below:

 

Picture1.png

SBax
Impactful Individual
Impactful Individual

I will attempt to replicate this tomorrow and come back to you

SBax
Impactful Individual
Impactful Individual

@onyebuchiboss - on occasion the intellisense doesn't show all options. What happens if you type part of the choice name? (e.g. "Not Granted")

When I type "Not Granted", I get the error - 'Not Granted not recognised'

SBax
Impactful Individual
Impactful Individual

Leave it with me, I'll build out the same choice column with the same values and see what I can find out 

onyebuchiboss
Helper III
Helper III

Thanks. The IntelliSense is showing me old values, the options (text) were recently changed including the values, so I don't know why its showing the older options.

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (2,232)