cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JRO
Frequent Visitor

Canvas App -On Start - User variables

Does anyone know if underscores are not allowed in usernames variables to make them successful? 

 

Issue: I built a canvas app with SharePoint as the data source. I figured out how to use Office 365 users to match the SharePoint person field because the User() is the UPN. Our UPN's do match our Office 365 usernames and emails (case sensitivity mostly)

 

I have a SharePoint list called Responsible, and in that list 2 fields that are called. One is Role (choices) to allow certain users to see certain screens, the other is Responsible (person).

 

This works perfectly until we get to some of our users who have user names such as this: b_johndoe@company.com . It is not working for them and they are not seeing the screen.

 

questions2.PNG

 

questions1.PNG

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
JRO
Frequent Visitor

I was able to solve this by using multiple Or statements and using Lower on both ends.

Matches Display name or matches Office email Or matches the user email. This should cover all instances of mismatches hopefully. 🙂

View solution in original post

4 REPLIES 4
theapurva
Super User
Super User

Hello,
please try using the userPrincipalName instaed of mail
so formula should be:

Set(VarUserMail,
Office365users.userprofileV2(User().email).userPrincipalName)

 

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

Thank you for the response! Unfortunately that made no difference. 

JRO
Frequent Visitor

Thanks to Mathew Devaney blog I found how I can get rid of those 2 first characters, but I need to do this on Start of app and I am not sure where this code would reside in the above code? I would need to have it on both sides of the equation.

 

I can add this to a label in a gallery, but I need to incorporate it into the On Start after grabbing the logged in User.

I then want to show a tab if that user is a match (after getting rid of the first 2 characters in the username.

 

Lower(Right(VarProfileUserEmail,Len(VarProfileUserEmail)-Find("_",VarProfileUserEmail)))

 

questions3.PNG

 

JRO
Frequent Visitor

I was able to solve this by using multiple Or statements and using Lower on both ends.

Matches Display name or matches Office email Or matches the user email. This should cover all instances of mismatches hopefully. 🙂

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,848)