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

Setting Field Default Value to be the logged in persons manager

Hi

 

I am using powerapps to populate a sharepoint list.

 

I want to pass a value of the current users manager over to sharepoint via a field on the form when the form is submitted - I dont want the user to pick the manager, i want the system to auto populate it.

 

I have been using the Office365Users.Manager string but its just not bringing the data back - is there a simple way to do this? (note: I can pass the users department over no problem using Office365Users.MyProfile().Department its the manager piece that is causing me trouble)

 

Thanks in advance 

 

Graham

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Setting Field Default Value to be the logged in persons manager

Hi @The_General 

 

Use Office365Users.ManagerV2(User().Email).displayName

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

3 REPLIES 3
Dual Super User
Dual Super User

Re: Setting Field Default Value to be the logged in persons manager

Hi @The_General 

 

Use Office365Users.ManagerV2(User().Email).displayName

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

Highlighted
Community Support Team
Community Support Team

Re: Setting Field Default Value to be the logged in persons manager

Hi @The_General ,

Which type column do you use to store the Manager user value in your SP list? Single text column or Person type column?

Do you want to auto-populate the field in your Edit form based on the curret login user's manager?

 

1. If you use Person type column to store the Manager user value in your SP List:2.JPG

Set the DefaultSelectedItems property of the ComboBox within the Person field data card to following:

If(
    EditForm1.Mode = FormMode.New,
    { 
      Claims: "i:0#.f|membership|" & Lower(Office365Users.Manager(User().Email).Mail),
      DisplayName: Office365Users.Manager(User().Email).DisplayName,
      Email: Office365Users.Manager(User().Email).Mail,
      Department: "",
      JobTitle: "", 
      Picture: ""
   },
   Parent.Default
)

2. If you use Single text type column store the Manager user value in your SP List:

Set the Default property of the Text Input box within the Person field data card to following:

Office365Users.Manager(User().Email).DisplayName

More details about setting a default value for Person field in SP list, please check the following thread:

https://powerusers.microsoft.com/t5/General-Discussion/How-to-set-a-defaul-value-for-a-person-fields...

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
The_General
Level: Powered On

Re: Setting Field Default Value to be the logged in persons manager

Thanks - this is just what I needed. Appreciate the help.

 

I was missing the User()Email bit and struggled to find any clear info on the syntax

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

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