We recently had a PowerApps request to default the value of a “Person or Group” active directory enabled form field to the Display Name of the logged in user while allowing the logged in user to change the contents of the “Person or Group” field to effectively make a request on behalf of another member of the organization. This blog walks you through the strategy used to deliver this request.
To set the stage, the PowerApps form was a header, detail form (which is a worthy of a post in itself) which creates and updates SharePoint Lists. There are two components of the “Person or Group” card that come into play in this scenario. At the card level, the “Update” property must be altered to display the “User().Fullname” if the card value is blank. Since this is tied to a “Person or Group” column in SharePoint, we must use the JSON notation to fill the required key value pairs for this data type.
Part two of this requirement requires us to update the “DefaultSelectedItems” property in the data card value box. We will use the same JSON structure at data shown above, but this time we will fill the card value box with the LastSubmit.<field name> value. If we recall, this is a header detail form which allows the user to create several line items for a single header. So, we want the original value to be retained.
You may wonder how we determined how to apply the JSON for this scenario. Yes, there are user forums and other forms. But, for the do-it-yourselfer, Flow is an invaluable tool to assist with figuring out the notation and key-value pairs. Viewing the test results of a simple get items flow step reveals the structure of a “Person or Group” column in SharePoint. Feel free to contact us if you have question or needs assistance with your Power BI, PowerApps, Flow, or data science initiatives. Our Business Intelligence services are available to help business get the most out of Power BI.Source: Featured image source