cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Patron
Post Patron

To get manager of author created by

In my powerapps form linked to sharepoint list, I am trying to check a condition where the manager of the created by person (author) of the list item and the current user is same or not.

To achieve this I used the formula :-


but i get the below error message -

Office365Users.Manager Failed: The method Manager has an invalid value for parameter userId



I even tried to use Office365Users.ManagerV2 - still the same.

Kindly help as I am very new to powerapps and in the learning process.
16 REPLIES 16
Dual Super User II
Dual Super User II

Hi @cyberco01 

 

Can you update your expression as:
If(If(!IsBlank(ThisItem.Author.Email),Office365Users.Manager(ThisItem.Author.Email).Mail = User().Email,true) || User().Email = "abc@xyz.com" || User().Email = "mno@xyz.com",Edit,View)
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!
Dual Super User III
Dual Super User III

Where are you applying the formula?  I put essentially the same formula in the DisplayMode property on an EditForm Data Card and it worked fine.  It did give me an error before I ran it, but that was because the properties were empty prior to the first run.  Here's the formula I used.

If(Office365Users.ManagerV2(ThisItem.'Created By'.Email).mail=User().Email||User().Email="xyz@company.com",DisplayMode.Edit,DisplayMode.Disabled)

Note that I used 'Created By' rather than Author.  My list doesn't have an Author Field



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Anonymous
Not applicable

Hi @cyberco01 how are you progressing with this? Were the above replies helpful? 

 

@Anonymous 

Hi @Anonymous ,

I applied the formula suggested by @Pstork1, I am yet to test it to confirm the same. I will surely close this once I am confirmed testing.

@Pstork1 ,

 

I tried below formula in the visible property of my datacard but it does not work.  I need to display the data card only for the manager of the List Item created user.

If(User().Email=(Office365Users.Manager(ThisItem.'Created By'.Email).Mail),true, false)

 

@Pstork1 , Below is my error

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

Two suggestions.

 

1) I would save the email address of the current user in the App OnStart. That will make the formulas more efficient

Set(currentUser, User().Email)

 2) I would use this for the comparison in the visible property

StartsWith(Office365Users.Manager(currentUser).Mail,currentUser)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

@Pstork1 ,

In my scenario i need to store the email address of Author/Created By user of the list item(record) and not the logged in user.  I am stuck with syntax at that place.

 

Sorry, I made a mistake in the function I gave you.  It should be

StartsWith(Office365Users.Manager(ThisItem.'Created By'.Email).Mail,currentUser)


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Helpful resources

Announcements
News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (7,023)