Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM forum
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 
  • 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 5 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,068 Super User 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.

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans