cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AndrewCarter
Level 8

userProfile Variable

Just a heads up if you find yourself in a similar position.

I have a global variable called userProfile which is set on APP start to the current user,

 

Set(userProfile, Office365Users.MyProfile())

 

If the current user is an APP owner, then they can switch to debug mode and select the current user, I do this on clicking the users image.

If(_IsAdmin, Set(userProfile, {});
Set(_Debug, !_Debug);
If( _Debug, 
Set(userProfile, Office365Users.UserProfileV2("selected user email")),
Set(userProfile, Office365Users.MyProfileV2())
);
Select(icoRefresh))

 

However, when you then look at the variable you will notice a really odd thing which becomes very annoying.. The properties of the variable are duplicated and then dropped to lowercase, and the initial properties are blank and ProperCase..

This means all your lookups and filter fail, as the are looking at the wrong case I.E userProfile.Mail becomes userProfile.mail etc...

This is because the two versions of the MyProfile(), UserProfile() and MyProfileV2() and UserProfileV2() provide different cases on the properties.

This is probably intentional but it is easy to miss

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

New Badges

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors
Users online (4,781)