
Announcements
Hi,
i have a app using CDS data and can patch all fields to sharepoint fine, Apart from the user lookup fields.
example of what works fine
Patch('Corporate Data Capture Data List', Defaults('Corporate Data Capture Data List'), {ContractNo: contractnossei.Text, Contractname: contractnamessei.Text, Selected_Contractor: selectedcontractorssei.Text, Title: projectnumberssei.Text, Project_x0020_Name: projectnamessei.Text, Inspection_x0020_Date_x0020__x00: InspectionDatessei.SelectedDate}); Navigate('Browse Screen',ScreenTransition.Fade)
however when i try to patch the person field from the user entity i receive an error. Can data from a person lookup in CDS be saved into a sharepoint list and if so can people point me as to what im doing wrong?
List column is a person/group field
Error is invalid argument type. Expecting a record value, but of a differnt schema. Missing column. your formua is missing a column 'claims' with the type of text the function patch has some invalid arguments.
Site_x0020_Safety_x0020_Agreed_x94: ResponsiblepersonA1.Selected
Appreciate any help
Robert
Hi @BobbyNWG1992 ,
Do you want to update user information to SharePoint Person field?
If you do, I made a test and you may modify your formula like below:
Patch('Corporate Data Capture Data List',
Defaults('Corporate Data Capture Data List'),
{
ContractNo: contractnossei.Text,
Contractname: contractnamessei.Text,
Title: projectnumberssei.Text,
Project_x0020_Name: projectnamessei.Text,
Inspection_x0020_Date_x0020__x00: InspectionDatessei.SelectedDate,
Selected_Contractor:If(IsBlank(Office365Users.SearchUserV2(searchTerm:selectedcontractorssei.Selected.Email)),
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
DisplayName: selectedcontractorssei.Selected.'User Name',
Claims: "i:0#.f|membership|" & selectedcontractorssei.Selected.'User Name',
Department: "",
Email: selectedcontractorssei.Selected.Email,
JobTitle: "",
Picture: ""
},
Office365Users.SearchUserV2(searchTerm:selectedcontractorssei.Selected.Email)
)
}
)
//assuming the "selectedcontractorssei" is a Combo Box
And the reason to do this is because SharePoint Person type column is containing all users information in Azure AD with meta data, if you want to add new user into AAD, you’ll need to use those meta data, or use the LookUp function to find the existing user by comparing Email addresses. In above formula, we use Office365Users connector to check if that user is already in AAD.
Hope this helps.
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.