Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Dynamically select multiple DefaultSelectItems for a Person or Group Combo control linked to SharePoint list allowing multiple selections

(0) ShareShare
ReportReport
Posted on by

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:

  • Items:-> Choices([@Requests].Approvers).Email
  • Update:-> DataCardValue4.SelectedItems

 

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)

bovellr96_0-1716730073012.png

 

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.

  • Verified answer
    bovellr96 Profile Picture
    bovellr96 on at
    Re: Dynamically select multiple DefaultSelectItems for a Person or Group Combo control linked to SharePoint list allowing multiple selections

    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 

     

     

     

  • v-jefferni Profile Picture
    v-jefferni on at
    Re: Dynamically select multiple DefaultSelectItems for a Person or Group Combo control linked to SharePoint list allowing multiple selections

    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,

  • EddieE Profile Picture
    EddieE 4,641 on at
    Re: Dynamically select multiple DefaultSelectItems for a Person or Group Combo control linked to SharePoint list allowing multiple selections

    @bovellr96 

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard