In this course, we will learn to populate the currently logged user as a default value in SharePoint’s person column of Canvas App. Before we start, make sure to subscribe to CRM Crate so that you can stay up to date in the field of Power Platform.
Understanding the “Person” type column in SharePoint / Lists
The “Person or Group” column in SharePoint Online is used to get user or group value. This field can be configured to accept any value from the authentication provider, such as the Active directory, or can be restricted to fetch individuals from a particular SharePoint group.
Why do we need to populate a default value in the Person Column of Canvas App?
Consider a business scenario where the Canvas App‘s logged-in user needs to get auto-populated in the “Person” column of the Canvas App. We can achieve such requirements with the help of the below given PowerFX solution.
For demonstration purpose, we will populate the value of the currently logged-in user as a default value in the Person column named “Who Am I?”.
PowerFX Code for populating a default value in the Person column of SharePoint list
Follow the below steps for auto-populating the value of the logged-in user in the Person column of SharePoint list.
- Navigate to the Power Apps studio (https://make.powerapps.com/) and open the Canvas App which contains the form/field pointing to the SharePoint list as its data source.
- Navigate to the column type as “Person” (Who Am I) and navigate to its “DefaultSelectedItem” property as shown below.
- Now, use the below given PowerFX code for auto-populating the currently logged-in user in the Person column / field.
If(
Form.Mode=FormMode.New,
{
DisplayName: User().FullName,
Claims: "i:0#.f|membership|" & Lower(User().Email)
},
Parent.Default
)
- Save & publish the Canvas App once the above configurations are completed.
Play the Canvas App and validate the above implementation
Go the the Power Apps studio (https://make.powerapps.com/) and play the Canvas App. Verify if the currently logged-in user is getting auto-populated in the Person column of SharePoint list as shown below.
Thus, we learned to populate a default value in SharePoint’s person column of Canvas App.
You have a way of making each of your readers feel seen and heard That’s a special quality that not all bloggers possess Thank you for creating a safe space for us
Your words have a way of touching hearts and inspiring minds Thank you for using your platform to spread love and positivity
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.