cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gayathri_TU
Helper II
Helper II

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

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
EricRegnier
Super User
Super User

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

View solution in original post

6 REPLIES 6
rampprakash
Super User
Super User

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

Gayathri_TU
Helper II
Helper II

@rampprakash 

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

dpoggemann
Super User
Super User

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"...

Hope this helps. Please accept if answers your question or Like if helps in any way.
Thanks,
Drew
EricRegnier
Super User
Super User

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
Super User
Super User

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

Gayathri_TU
Helper II
Helper II

@Prakash4691 @EricRegnier @dpoggemann 

 

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

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,836)