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 / Request Leave Template...
Power Apps
Answered

Request Leave Template Manager Error

(0) ShareShare
ReportReport
Posted on by 30

Hello. I am trying to use Request Leave Template of Microsoft but I get an UserId error in this part of the code:

 

Set(_defaultApprover;Office365Users.ManagerV2(_myProfile.Id));;

 

I tried many solutions on this forum, but I couldn't fix my problem. I tried to change the code as requested in these solutions like:

 

Set(_defaultApprover;Office365Users.ManagerV2(_myProfile.Mail));;

 

But I got same error. I am trying to solve it almost an hour. Could someone help me please?

Categories:
  • jbrit2020 Profile Picture
    638 on at

    Try this

     

    Set(_defaultApprover;Office365Users.ManagerV2(Office365Users.UserProfile(User().Email).Id))

     

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello @AnnaDewitt,

     

    Can u specify what information do You want to get? I understood that You want to get something from Your profile on O365. Is it email? if it is u can get it from: User().mail

  • jbrit2020 Profile Picture
    638 on at

    I believe the user is trying to set a variable for the default approver which is the manager of whoever the current user is.

  • AnnaDewitt Profile Picture
    30 on at

    I tried it but I got same error. Some people say that if I don't have manager name on Azure, this error occurs. Can it be true?

  • AnnaDewitt Profile Picture
    30 on at

    This is template, I didn't write the code. But it tries to find manager infos to find manager email, name, etc. Like below:

     

    Set(_defaultApprover;Office365Users.ManagerV2(_myProfile.Id));;
    If(Office365Users.UserPhotoMetadata(_defaultApprover.Id).HasPhoto; Set(_defaultApproverPhoto; Office365Users.UserPhoto(_defaultApprover.UserPrincipalName))));;

     

  • jbrit2020 Profile Picture
    638 on at

    can you share a snapshot of what you currently have in there? where you want to display names etc.

     

    A test you can do to check if you have a manager or not in azure is create a label and put it anywhere in you app and then in text put the following: Office365Users.ManagerV2(Office365Users.UserProfile(User().Email).Id).displayName

     

    If nothing shows up then you don't have a manager in azure or you don't have azure AD at all, which might be the case.

  • AnnaDewitt Profile Picture
    30 on at

    I tried to open Azure but I don't think we have Azure account in company.

  • Verified answer
    jbrit2020 Profile Picture
    638 on at

    the test I've mentioned before you do it in powerapps, you add a label anywhere and put the code I've added, if it returns your manager's name, than you have azure AD and a manager assigned to you. If you don't, then that's probably where your problem lies.

  • AnnaDewitt Profile Picture
    30 on at

    Thank you. I tested your code and I get an error again. It is because Azure then. It is so sad that I spend two hours for nothing 🙄

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 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard