top of page
Search

Setting a SharePoint Person Column to Default to the Logged-in User in Power Apps

Dealing with SharePoint complex columns can be a challenge for many Power Apps makers, especially when it comes to working with People columns and Combo Boxes. But don't worry, we're here to help you master the DefaultSelectedItems property and make your life easier!


In this 55-second video, we show you how to set a SharePoint People column to default to the currently logged-in user. Follow along as we walk you through the steps below.


Create the record

The first step is to set the ComboBox's DefaultSelectedItems property to the expected record format. Use the following code:


{

Claims: "i:0#.f|membership|" & Lower(User().Email),

Department: "",

DisplayName: User().FullName,

Email: User().Email,

JobTitle: "",

Picture: ""

}


This code should work in your app without any modifications.


Make it default when the field is blank

Be careful not to overwrite existing values. Use the Coalesce function to avoid this issue:


Coalesce(ThisItem.Manager,

{

Claims: "i:0#.f|membership|" & Lower(User().Email),

Department: "",

DisplayName: User().FullName,

Email: User().Email,

JobTitle: "",

Picture: ""

}

)


Don't forget to replace the Manager column with your Person column name.


Make it default only when the form is in New mode

Sometimes, you only want the current user to be the default when creating a new record. In that case, use the following code for your DefaultSelectedItems property:


If(EditForm1.Mode = FormMode.New,

{

Claims: "i:0#.f|membership|" & Lower(User().Email),

Department: "",

DisplayName: User().FullName,

Email: User().Email,

JobTitle: "",

Picture: ""

},

ThisItem.Manager

)


Make sure to change EditForm1 and Manager to your actual values as necessary.


Summary

Now you have all the pieces of the puzzle to set a SharePoint People column to default to the logged-in user in Power Apps. You might need to adjust the code to fit your specific scenario, but we believe in your ability to make it work. If you need help, feel free to use our Contact form. We offer quick free help, paid screen-sharing assistance and mentoring, training classes, and even full project services. If you have a Power problem, we have a Powerful answer. 😄

3,643 views
bottom of page