cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
lkaspar
Level: Powered On

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 REPLY 1
Dual Super User
Dual Super User

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

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!

Helpful resources

Announcements
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 (Last 30 Days)
Users online (4,844)