web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Model Driven App - Con...
Power Apps
Answered

Model Driven App - Control Visibility Of A Custom Command Bar Button based on logged in User

(0) ShareShare
ReportReport
Posted on by 64

I have added custom button using command bar , I need to control the visibility of the button based on the logged in user . 

Logic - Button should be visible only if assigned to user is equal to the current user.

I have added below power FX code , but the code doesn't seem to work , can you please guide me where I am doing wrong.

If(Self.Selected.Item.'Assigned to'.'Primary Email'=User().Email,true,false)
 
Gayathri_TU_0-1648460092655.png

 

I have the same question (0)
  • Ram Prakash Duraisamy Profile Picture
    5,593 Super User 2025 Season 2 on at

    Hello @Gayathri_TU 

     

    Hope you are doing good.

     

    As per my knowledge its related to LOWER or UPPER case issue.

     

    Try converting Both Side to Lower or Upper and Try again.

     

     

    Please mark as Answer if it is helpful and provide Kudos

     

    Subscribehttps://www.youtube.com/channel/UCnGNN3hdlKBOr6PXotskNLA

    Blog : https://microsoftcrmtechie.blogspot.com

  • GayathriTU Profile Picture
    64 on at

    @rampprakash 

    Thanks for reply , I have tired as per suggestion but still not working

  • Drew Poggemann Profile Picture
    9,287 Most Valuable Professional on at

    Hi @Gayathri_TU ,

     

    Couple things:

    1.  Does the user logged in have the permissions to view the User entity across the Business Unit or Organization?  If not then when you are referencing through the 'Assigned To' it may not have the permissions to get the email field on the user.

    2.  You are checking Assigned To, is this a custom field on your table that is a User lookup type?  I would expect you would normally be checking the "Owner"...

  • Verified answer
    EricRegnier Profile Picture
    8,720 Most Valuable Professional on at

    Hi @Gayathri_TU,

    This a known issue. Power FX logic for command bar have known issue with visibility and lookups. The product team is aware and will fix but not specific ETA yet. Note command bar Power FX is still in preview so might have more glitches like this. Apologies on their behalf for the inconvenience.

    Cheers

  • Prakash4691 Profile Picture
    1,332 on at

    Hi @Gayathri_TU ,

    It should work. Make sure you save and publish the changes done in command designer. Wait for notification you get as per below screenshot and refresh to see your changes or if you want to see your changes instantly, hard refresh your browser by pressing (ctrl + f5) multiple times.

    Prakash4691_0-1648543939377.png

    As recommended, it is not best practice to use in production instance because it is still a preview feature. Same thing you can able to achieve using JavaScript.

     

    If it answers your question, kindly give kudo and accept it as solution.

     

    Regards,

    Prakash

  • GayathriTU Profile Picture
    64 on at

    @Prakash4691 @EricRegnier @dpoggemann 

     

    Thanks for helping me out , I have achieved the same using the JavaScript code as PowerFx didn't provide desired solution .

  • Dhana1207 Profile Picture
    2 on at

    @Gayathri_TU @EricRegnier   I am also facing the same issue. Can i know whether any this issue is fixed and published. Thank you

  • JackinSir Profile Picture
    2 on at

    Can you shared me the code which you doing visible with JavaScript. I want to show command button in javascript code. The property Visibility of command button in power fx code i want to  change it to javascript code. Please give me example of doing that 

  • EricRegnier Profile Picture
    8,720 Most Valuable Professional on at

    Hi @Dhana1207, I would raise a Microsoft Support ticket at https://admin.powerplatform.microsoft.com/support to get more info on the bug, thanks

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard