Patching People Picker and Choice Dropdowns to SharePoint from PowerApps

Patching People Picker and Choice Dropdown Columns in PowerApps to SharePoint

People always run into issues when patching the people picker column and the choice column. This is because these columns require a certain format for SharePoint to sit easy with them.

Choice Column

Lets start with the choice column. First of all, its always good practice that if you have a dropdown control on the canvas and the values have to match the SharePoint column you are referencing. Do not add the values manually. ['Item A','Item B','Item C']. Rather, you should reference the values of the choice column directly from SharePoint. This is done by setting the 'Items' property of your control to the following

Choices(Tasks.Status)

The 'Tasks' is going to be your list you are referencing. The 'Status' is the column you are pulling values from.

Once you have that set. To patch it back into SharePoint. Pass the following paramaters.

Patch('Tasks',
   Defaults('Tasks'),
{Status:
 {'@odata.type':'#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference',
   Id:1,
  Value:StatusControl.value}
 }
)

Change the data sources to match your lists. For the Value:{Insert your control name}.value

Thats it!

People Picker Column

This one is the same but requires a bit more configuration. Since in the SharePoint backend,  the people picker is stored as three sets of levels. One for the user email, one for the user name, and one for the user id. When you patch, you have to make sure all three are entered correctly to the correct user. Say my name is 'John Doe'. I'm logged into my PowerApps. I want to set the 'Owner' field, which is a people picker field, in SharePoint to me. Here's the format.

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

See where I added User() values. This pulls my current logged in details. If you follow that format. Your patch should be 'A okay'.

That's all for now!

 




Leave a Reply

Your email address will not be published.


Comment


Name

Email

Url