I would like to dynamically select multiple DefaultSelectedItems of a combo form control linked to a SharePoint Person or Group column that allows multiple selections. The column in my SharePoint list is named ‘Approvers’. The DataCardValue items property and DataCard Update properties are shown below:
To set the DataCardValue defaults, I created a collection (ApproverList) of user emails which is updated OnChange of the selection in another combo control used to derive the Approval Group ((Development or Maintenance).
I then use the ApproverList collection to set the DefaultSelectedItems property of the Approver combo as follows:
ForAll(ApproverList,LookUp(Approvers, DisplayName.Email = ApproverEmail).DisplayName.Email)
However, the DefaultSelectedItems are not being updated in the SharePoint list when a new order request is submitted.
I would therefore be grateful for your assistance in identifying the error(s) in my scripts and\or suggest an alternative approach to achieve the desired result.
Thank you both for your assistance. Neither of the above solution worked outright, but they served to point me in the right direction. I updated the 'Items' property to: Choices([@Requests].Approvers) and the 'DefaultSelectedItems' property to return a table of Claims as suggested by @v-jefferni and @EddieE . However, the table of Claims on it's own did not select the required items by default and neither were the items updated in the SharePoint list.
For the solution, I therefore amended the ApprovalList collection to include Claims, DisplayName & Email for the default approvers as follows:
ClearCollect(ApproverList,ForAll(colApprovers,{Claims:ThisRecord.Value.Claims,DisplayName:ThisRecord.Value.DisplayName,Email:ThisRecord.Value.Email}))
I then updated the DefaultSelectedItems property as per @v-jefferni to include the Claims, DisplayName and Email fields which worked. See final solution below:
ForAll(ApproverList,{Claims:"i:0#.f|membership|"&Lower(LookUp(Approvers,Email=ThisRecord.Approver.Email).Approver.Email),DisplayName:LookUp(Approvers,Email=ThisRecord.Approver.Email).Approver.DisplayName,Email:LookUp(Approvers,Email=ThisRecord.Approver.Email).Approver.Email})​
Conclusion: SharePoint requires the Claims, DisplayName and\or Email fields in order to update the the SP List from the Combo DefaultSelectedItems property.
Thanks again for your kind assistance. Much appreciated @EddieE and @v-jefferni
Hi @bovellr96 ,
Please first change the Items property to Choices([@Requests].Approvers) if the Approvers column in Requests list is a people column. After that, DefaultSelectedItems property would be:
ForAll(ApproverList,{Claims: "i:0#.f|membership|" & Lower(LookUp(Approvers, DisplayName.Email = ThisRecord.ApproverEmail).DisplayName.Email)})
Best regards,
Create your collection (ApproverList) using actual records from the Person field - use Filter to get names. This will create a 'table' of results, similar to the schema of a person field.
The reason your patch/update isn't working is because you are trying to patch STRING values to a TABLE type field