cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Icon visibility issue on a screen

Hi,

 

We have an approval icon on the home screen which the approver should see on the home screen when clicks on the app link he receives in a email triggered from Power apps. 

 

When we hardcoded the email address of the user in the Power apps code then we can see the icon but when user uses the link of the app then the icon is not visible.

 

 

Backend Screen with the icon when app ran as an impersonation of the user

Prathameshpatka_0-1656420536391.png

 

Screen with no icon when user clicks on the link :

 

Prathameshpatka_1-1656420644750.png

 

 

 

 

18 REPLIES 18
iAm_ManCat
Super User
Super User

What is your app using to check this? User().Email? User().Email is actually the user's user principal name, not their primary smtp address. You can use the Office365Users connector to get the current user's primary smtp email address.

 

I have this tip listed in my Power Apps Forms tips and tricks part 3 here

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Hi @iAm_ManCat ,

 

I did use the office365users.Myprofile().mail connector to get the email address instead of varcurrentuser in the below code but it still doesn't work unfortunately. varcurrentuser is defined as user().email which I did change to office365users.Myprofile().mail

 

The top one ApproverNominationsAll collection itself is not getting any count which causes the second collection to also have no records.

 

Prathameshpatka_0-1656558675664.png

 

 

As I said in the article, there are a number of issues to get past - firstly = is case sensitive so

john@microsoft.com

is NOT equal to

John@microsoft.com

 

So you need to wrap things in Lower() to make sure the comparisons are going to all be the same case.

 

Then you also need to check both the UPN and Email, in case the value has been stored as either, so you made your varCurrentUser equal to the email, it should be Set( varCurrentUserEmail, Lower(office365users.Myprofile().mail)) and then you should also define Set( varCurrentUserUPN, Lower(office365users.Myprofile().userprincipalname)), then in your formula update each of the approvers to check for both types, like

Lower('Approver - Group Director'.Email) = varCurrentUserEmail || Lower('Approver - Group Director'.Email) = varCurrentUserUPN

 

I would also suggest putting your first formula (from the addcolumns part) in a gallery for debugging to see what values are returned

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


@iAm_ManCat 

 

I had amended the condition as below and asked one of Regional directors to open the app and see if the icon appear but unfortunately it is still not working

 

Prathameshpatka_0-1656581474168.png

 

Variables are set as below :

 

 

Prathameshpatka_1-1656581493067.png

 

Prathameshpatka_2-1656581527786.png

 

 

Have you done any debugging?

You could also have them open a monitor session and see where its pulling the wrong data

alternatively, insert three labels into the gallery I suggested in my last post,

varCurrentUser

varCurrentUserUPN

'Approver -  Group Director'.Email

 

that way you get the user to log in and their email/upn will show and the filtered list of items will show - you should be able to determine where the mismatch is happening that way

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


@iAm_ManCat 

 

Yes we have tried hardcoding the email address in the code but it still doesn't work. What I have observed now as per your suggestion is that the

varCurrentUser

varCurrentUserUPN

shows the below values : the first one is the varcurrentuser and the second one is varcurrentuserupn

Prathameshpatka_0-1656584922439.png

 

On the SP list the coloumn 

'Approver -  regional Director'.Email has this email address.

 

Prathameshpatka_1-1656585042777.png

 

Looks different ? but we are still making it to Lower('Approver - Regional Director'.Email ) ? so not sure why it isn't working ?

 

When Kaval uses the App, what are the currentUser and CurrentUserVPN values? if they don't match the column then the filter won't return anything so this would be a good place to start looking.

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


@iAm_ManCat 

 

So when kaval logs in the varcurrentuser is Kaval.Patel@b..h..com and varcurrentuserupn is kaval.patel@b..h..com

 

While on the the list it is Kaval.Patel@B...H...com

 

But my question is we are already making Lower('Approver - Regional Director'.Email ) = Lower (varcurrentuser) so should that still make a difference ?

 

If it still affects how do I make it lower in the list as well ?

@Prathameshpatka ,

Try

StartsWith(
   'Approver - Regional Director'.Email,
   varcurrentuser
) 

which is not case-sensitive

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,782)