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

Person/group field to display user

How can I pre-populate a person/group field in my form to display current logged in user in a combo box?

I've tried using the formula below but the user name does not appear on the view page or even when I want to edit the form the name is not there, also checked on the sharepoint list to see whether the name has been saved on the list and it hasn't, not quite sure what to do there

If(
  Form1.Mode=FormMode.New,
  {
   Claims: "i:0#.f|membership|" & User().Email,
   DisplayName: User().FullName
  }

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @SandraAkujobi ,

Ok, so you mean this form's mode maybe new or display or edit?
If so, you just need to add the result when mode is display or edit.

Try to set the combo box's DefaultSelectedItems like this:

If(
  Form1.Mode=FormMode.New,
 {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:"i:0#.f|membership|" & User().Email,
    Department:"",
   DisplayName:User().FullName,
         Email:User().Email,
      JobTitle:"",
       Picture:""
   },
ThisItem.fieldname)
//please replace with your person field name

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
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

4 REPLIES 4
v-yutliu-msft
Community Support
Community Support

Hi @SandraAkujobi ,

Do you want the combo box for person field display as current user if the form's mode is new?
Could you tell me whether this person field allow multiple person?
If no, please set the combo box's DefaultSelectedItems like this:

If(
  Form1.Mode=FormMode.New,
 {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:"i:0#.f|membership|" & User().Email,
    Department:"",
   DisplayName:User().FullName,
         Email:User().Email,
      JobTitle:"",
       Picture:""
   })

If yes, please set the combo box's DefaultSelectedItems like this:

If(
  Form1.Mode=FormMode.New,
Table( {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:"i:0#.f|membership|" & User().Email,
    Department:"",
   DisplayName:User().FullName,
         Email:User().Email,
      JobTitle:"",
       Picture:""
   }))

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-yutliu-msft It worked but the only problem is that it doesn't display the name of the employee on the detailed/edit page. Also the field does  not allow multiple person.

Screenshot (3).png

 

Hi @SandraAkujobi ,

Ok, so you mean this form's mode maybe new or display or edit?
If so, you just need to add the result when mode is display or edit.

Try to set the combo box's DefaultSelectedItems like this:

If(
  Form1.Mode=FormMode.New,
 {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
        Claims:"i:0#.f|membership|" & User().Email,
    Department:"",
   DisplayName:User().FullName,
         Email:User().Email,
      JobTitle:"",
       Picture:""
   },
ThisItem.fieldname)
//please replace with your person field name

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
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

@v-yutliu-msft thanks so much that worked.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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 (1,147)