cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
lkaspar
Helper I
Helper I

The method 'ManagerV2' has an invalid value for parameter 'id'

Hi

 

I am customising a SharePoint form using PowerApps. The column Requester Name is of type Person / Group, users can look up users in Azure AD. Based on this field other fields are populated and written to the SharePoint list on submit, including:

  • the looked up user's job title
  • the looked up user's manager
  • the looked up user's manager's job title

Sometimes, the selected user will not have some or all of the above properties.

image.png

 

This is the code I have written:

Default property on Manager Name DataCardValue

If(
    !IsEmpty(DataCardValue15.Selected),
    Office365Users.ManagerV2(DataCardValue15.Selected.Email).displayName
)

 

Similar code is executed on the Text and Default property on the DataCardValues of Requester Title and Manager Title.

 

What I was expecting:

If a user is selected in Requester Name, return and display information about them/their manager.

 

What actually happened:

 

Scenario 1

A user has not been selected, the following error message is displayed:

Office365Users.UserProfileV2 failed: The method 'UserProfileV2' has an invalid value for parameter 'id'

 

I am not sure why this is happening since the condition of a user being selected is not being met, therefore the second part should not run.

 

Scenario 2

A user has been selected but the AD object is missing some information and is displaying the below error:

Office365Users.ManagerV2 failed: {
  "error": {
    "code": "Request_ResourceNotFound",
    "message": "Resource 'manager' does not exist or one of its queried reference-property objects are not present.",
    "innerError": {
      "request-id": "20a0f2e1-52e7-4e83-a1e8-6b13dfdc09c5",
      "date": "2019-11-28T04:54:33"
    }
  }
}

 

I am not catching this error, so this is okay. Does anyone know of a way to catch this error?

 

How do I return information about a user that is selected dynamically and how do I handle errors if no/the wrong information is returned? Am I on the right track here? Any help would be appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hey @lkaspar 

 

This seems to be a limitation of Office365 users when a manager does not exist for the employee. The data in AAD needs to be correct and appropriate for all the users to work with this case. Though you can apply some kind of exclusion for employees who do not have managers like: https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Office365Users-Manager-throws-error... 

While to make this work for the employees that have manager details stored, please update the default property of the data-cards as:

Employee Title:

If(
!IsEmpty(DataCardValue15.Selected),
Office365Users.UserProfileV2(DataCardValue15.Selected.Email).jobTitle
)


Manager Name:

If(
!IsBlank(DataCardValue15.Selected.Email),Office365Users.ManagerV2(DataCardValue15.Selected.Email).displayName)


Manager Title:

If(
!IsBlank(DataCardValue15.Selected.Email),Office365Users.ManagerV2(DataCardValue15.Selected.Email).jobTitle)

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

1 REPLY 1
yashag2255
Dual Super User II
Dual Super User II

Hey @lkaspar 

 

This seems to be a limitation of Office365 users when a manager does not exist for the employee. The data in AAD needs to be correct and appropriate for all the users to work with this case. Though you can apply some kind of exclusion for employees who do not have managers like: https://powerusers.microsoft.com/t5/Building-Power-Apps-Formerly/Office365Users-Manager-throws-error... 

While to make this work for the employees that have manager details stored, please update the default property of the data-cards as:

Employee Title:

If(
!IsEmpty(DataCardValue15.Selected),
Office365Users.UserProfileV2(DataCardValue15.Selected.Email).jobTitle
)


Manager Name:

If(
!IsBlank(DataCardValue15.Selected.Email),Office365Users.ManagerV2(DataCardValue15.Selected.Email).displayName)


Manager Title:

If(
!IsBlank(DataCardValue15.Selected.Email),Office365Users.ManagerV2(DataCardValue15.Selected.Email).jobTitle)

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Top Kudoed Authors
Users online (3,328)