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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Half of my users are i...
Power Apps
Unanswered

Half of my users are in Active Directory and the other half are in 0365 I need to get the "supervisor" of the logged in user

(0) ShareShare
ReportReport
Posted on by 516

The company I work for decided to do a split of users for a test of 0365 and Active Directory users. I have a mix of user accounts that log into the PowerApp.

What I do know if I do these under visible:

AD users:

SharePointIntegration.Selected.'Supervisor Email'.Email=CurrentUser.Email

 

0365 users
SharePointIntegration.Selected.'Supervisor Email'.Email=UserProfile.Email

 

Individually they work. 

but I need both of these to work 

When I try :
SharePointIntegration.Selected.'Supervisor Email'.Email=CurrentUser.Email && SharePointIntegration.Selected.'Supervisor Email'.Email=UserProfile.Email

 

I get errors.

 

how can I get the visible to take both lines of code, that way no matter if the user is in AD and or the 0365 that it will pick up the email address.

Categories:
  • rpersad Profile Picture
    831 on at

    Can you send a screenshot of the error.

  • SPS-DEV-22 Profile Picture
    516 on at
     

    SharePointIntegration.Selected.'Supervisor Email'.Email=UserProfile.Email

    SPSDEV22_1-1692036604176.png

     

    trying something like this:

    SharePointIntegration.Selected.'Supervisor Email'.Email=CurrentUser.Email (works with AD) && SharePointIntegration.Selected.'Supervisor Email'.Email=UserProfile.Email (throws the above error)
     
    I need to capture AD and 0365 users supervisor email
     
     
  • TheRobRush Profile Picture
    11,128 Moderator on at
    User().Email

    Or

    Office365Users.MyProfileV2().mail

    UserProfile.Email isn't a thing, unless you have a code that Set(UserProfile,Office365Users.MyProfileV2()) or something

  • SPS-DEV-22 Profile Picture
    516 on at

    I dont follow on your answer:

     

    So, I'm to put:

    SharePointIntegration.Selected.'Supervisor Email'.Email=CurrentUser.Email && SharePointIntegration.Selected.'Supervisor Email'.Email=Office365Users.MyProfileV2().mail

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Yah I mean depending on your organizations structure the two emails i provided above are the two ways to get the logged in users email. They may be (as in my organization) unique from one another as every user has two emails one based on employee # and another based on first.last at my compnay so you may have to try both of them.

    The UserProfile.Email you reference in the image isn't a thing/does not exist, and this is why it gives you an error.

  • SPS-DEV-22 Profile Picture
    516 on at

    ok, let me explain this alittle better.

     

    I have a form, where the person enters their supervisor email address. then the supervisor gets an email telling him to approve the item.

     

    if the supervisor's email address matches the email that the end user put in the supervisor field, then form fields just for the supervisor will appear on the form.

    currently, it is working for Active directory people. over ever 1/2 of the people were moved to 0365.  it isnt working for those supervisors. they do not see their form fields. where the AD group can see there form fields.

     

    this does not work

    SharePointIntegration.Selected.'Supervisor Email'.Email=CurrentUser.Email && SharePointIntegration.Selected.'Supervisor Email'.Email=Office365Users.MyProfileV2().mail

     

    I'm trying to get the form to work with BOTH AD and 0365 users . current the 0365 code is not working, including the code you supplied.

     

    oh, for the SharePointIntegration I have 

     

    onvisible

    Set(CurrentUser, User())

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Did you try both versions I sent?

     

    The other was 

    User().Email

     

     

  • SPS-DEV-22 Profile Picture
    516 on at

    I need them to be working at the same time. as  1/2 0365 supervisors and the other 1/2 are AD users

     

    this works:
    SharePointIntegration.Selected.'Supervisor Email'.Email=CurrentUser.Email 

     

    ONLY for Active Directory users.

     

    I need the related code for the 0365 users.

     

    the form fields need to be visible for the for the supervisors, if they are AD and or 0365

  • TheRobRush Profile Picture
    11,128 Moderator on at

    Outside of that not sure, I use both of these for my org and our entire userbase is in O365 and those two codes I provided give one of the two types of email each of our users have. If we were all just in AD i'd say maybe it was that, but we are all 0365

  • TheRobRush Profile Picture
    11,128 Moderator on at

    if one of the options i gave works for some people, and the other for other people, but neither for all, jhust put the two in an Or( ) brackets and it only needs to succeed on one of them

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 243 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 190 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard