Skip to main content

Notifications

Customer experience | Sales, Customer Insights,...
Suggested answer

Unable to see all optionset value in power fx expression while editing command bar

Posted on by 5

Hi 

I am facing an issue while editing command bar. I am trying to add a power FX expression on a button visibility formula. I want to pick an option set value and cehck what option is selected and based upon that will hide/show the button below is my expression

If(Self.Selected.Item.Status = 'Status (Notifications)'.Inactive && Self.Selected.Item.Notificationtype <> 'Notification Type'. Optionsetvalues , true, false)
The issue is that when I am trying the compare the Notification Type below 
Self.Selected.Item.Notificationtype <> 'Notification Type'. Optionsetvalues 
the expression is not showing all the Optionsetvalues  to add the condition, some options are not appearing in the expression
Please note Notification Type is a global option set and  Self.Selected.Item.Notificationtype  in the field using the global option set 
Also I am editing the model driven app only please let me know what am I missing how it can be fixed 
  • SajidSalim Profile Picture
    SajidSalim 3 on at
    Unable to see all optionset value in power fx expression while editing command bar
    @Dru56's answer fixed my problem. It seems like the PowerFX editor within Model-Driven Apps is buggy. When opening via Component Library, which is just a Canvas App, everything seems to be working fine.
  • Suggested answer
    RE: Unable to see all optionset value in power fx expression while editing command bar

    One thing to check is whether the global option set has any inactive options. Inactive options are not visible in the Power FX expression editor by default, so you may need to enable them to see all the options. To do this, follow these steps:

    1. Open the global option set definition in the Dynamics 365 solution.

    2. In the "Options" tab, click the "View" button in the ribbon.

    3. In the dropdown, select "Inactive options".

    4. Any inactive options will now be visible. Make a note of the exact spelling and capitalization of the option set values you want to use in your expression.

    Another thing to check is the syntax of your expression. It looks like you are using a dot notation to reference the option set values, but this is not the correct syntax for Power FX. Instead, you should use square brackets to reference the option set values. Here is the corrected expression:

    If(Self.Selected.Item.Status = 'Status (Notifications)'.Inactive && Self.Selected.Item.Notificationtype <> [Optionsetvalues], true, false)

    In this expression, the square brackets around "Optionsetvalues" indicate that it is a reference to the option set values in the global option set.

    Hopefully this helps you to fix the issue and set the visibility of your button based on the value of the global option set field.

  • Suggested answer
    Dru56 Profile Picture
    Dru56 7 on at
    RE: Unable to see all optionset value in power fx expression while editing command bar

    We had the same problem today.  I edited the same formula in the "Component Library" by using the "Open component library" button and all my option set values were visible there.  After saving, the original command bar editor window works as expected again.

    pastedimage1676989987097v1.png

  • Suggested answer
    Abdul Wahab Profile Picture
    Abdul Wahab 12,070 Super User 2024 Season 1 on at
    RE: Unable to see all optionset value in power fx expression while editing command bar

    Hi Sher M Khan Lodhi,

    I can see all the options. 

    pastedimage1676609858784v1.png

    It seems to refresh, cache, publish or have syntax (check above if this is the case) issues.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans