Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Hide model driven app command bar button based on environment variable value

(1) ShareShare
ReportReport
Posted on by 54

I created a new button with the new command designer. I would like to make this new button visible/invisible based on an environment variable value. 
It's possible to set the visibility using Power FX based on some conditions:

 

selimdag_0-1652109110218.png

 

selimdag_1-1652109177375.png

But I couldn't find a way to get the value of the environment variable value using Power FX. 

Can anyone help me with that? 

PS: I'm also open to other approaches.

 

 

 

 

 

Categories:
  • RobMolenaar Profile Picture
    RobMolenaar 97 on at
    Re: Hide model driven app command bar button based on environment variable value

    This was really helpful thanks!

  • CU20011233-0 Profile Picture
    CU20011233-0 54 on at
    Re: Hide model driven app command bar button based on environment variable value

    Hi @melamri

    that works pretty fine. Thanks a lot! 

  • Verified answer
    meelamri Profile Picture
    meelamri 468 on at
    Re: Hide model driven app command bar button based on environment variable value

    Hi, 

     

    You need to add two additional tables: Environment Variable Values and Environment Variable Definitions. To do this, you need to open the component library: 

    melamri_0-1652113535331.png

    Then you can the two tables (Environment Variable Values and Environment Variable Definitions): 

    melamri_1-1652113698690.png

    Also in the component library. You can now use a powerFx expression for the visibility of the button depending on the value of your environment variable. In my case, the environment variable is "mea_BtnVisibilityEV"

    melamri_2-1652113795759.png

    You will need to save and publish your component, like a canvas app component. Then, close everything and reopen the command designer, the visibility expression will now be inherited from the command library: 

     

    melamri_3-1652114116442.png

     

    It works in my environment (y)

     

    Please tick Accept as solution if the answer is useful.

    https://xrmtricks.com/

     

     




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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard