Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Using a Form to Update Multiple Users in a Person Field in SharePoint

Posted on by

Hello All,

 

I am currently using a PowerApp edit form connected to a SharePoint list. I have a Person Field "Addl_Team" on SP that allows multiple entries.

 

I can get my multiselect-enabled combobox in my form to create an entry with multiple people, but if I go back into the app and I decide that I need to add another person to these selections, it overwrites my existing multi-selections with just that one new person I picked.

 

This is the code I have attached to my Update function of my DataCard:

ForAll(DataCardValue12.SelectedItems,
{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: Mail,
DisplayName: DisplayName,
Email: Mail
})

 

I have a feeling it may be my DefaultSelectedItems on the DataCardValue in the combobox playing a role in this, but I want it so users can see who they already picked and add or subtract from there:

ThisItem.Addl_Team.DisplayName

 

Any ideas what might be wrong? Any other ways to populate the pre-existing selected people without this happening?

Please let me know if you need any more info.

 

Thanks so much and so very appreciated!

Lindsey

  • WarrenBelz Profile Picture
    WarrenBelz 143,487 on at
    Using a Form to Update Multiple Users in a Person Field in SharePoint
    When patching to a Person field, you need to send the whole schema. As you seem to be using the Office365Users.SearchUser function in the Items, this schema is different from that of the person field you are reading from / writing to, so the Update would be
    ForAll(
       DataCardValue12.SelectedItems As _Items,
       {
          Claims: "i:0#.f|membership|" & Lower(_Items.Mail),
          Department: "",
          DisplayName: _Items.DisplayName,
          Email: _Items.Mail,
          JobTitle: "",
          Picture: ""
       }
    )
    and the DefaultSelectedItems
    ForAll(
       ThisItem.Addl_Team As _Items,
       {
          Mail: _Items.Email,
          DisplayName: _Items.DisplayName
       }
    )
     
    Please click Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it a Like.
    MVP (Business Applications)    Visit my blog Practical Power Apps    Buy me a coffee
  • CU11111929-0 Profile Picture
    CU11111929-0 4 on at
    Using a Form to Update Multiple Users in a Person Field in SharePoint
    Hi All,
     
    Please let me add this information.
     
    If you plan to use Power Automate
    to send an email to multiple users in a single email,
    the following thread might be helpful:
     
     
    Thank you.
     
  • CU11111929-0 Profile Picture
    CU11111929-0 4 on at
    Using a Form to Update Multiple Users in a Person Field in SharePoint
    Hi All,
    The procedure below might work.
     
    Example of structure:
    Form1 > Card1 > ComboBox1

    The ComboBox should be of the type of classic ComboBox for now.

    Items property of ComboBox1:
     
    Choices(yourlistname.userfieldname)

    Update property of Card1:
     
    ForAll(ComboBox1.SelectedItems,

    {
    Claims: "i:0#.f|membership|" & Email,
    DisplayName: DisplayName
    }

    )

    OnSelect property of submit button:
     
    SubmitForm(Form1);
     
    Please let me know if you have any questions.
     
    Thank you
  • Paramesh Ulthi Profile Picture
    Paramesh Ulthi 6 on at
    Using a Form to Update Multiple Users in a Person Field in SharePoint
    Hi All,

    I'm facing the same issue, could you please let me know if this is solved or any turn around solution?
    Thanks in advance
  • Al_10 Profile Picture
    Al_10 1,691 on at
    Re: Using a Form to Update Multiple Users in a Person Field in SharePoint

    @Anonymous 

     

    ok. there is no need in flow to make it work.

     

    I need to know what is in:

    - updateForm.Item

    -updateForm.DataSource

    - datacard.datafield         (the datacard where the people combobox is added)

    - datacard.default            (the datacard where the people combobox is added)

    - combobox.Items

    - combobox.DefaultSelectedItems

    - when you submit a new form or submit edited form, do you use SubmitForm() or Patch()?

     

     

  • Re: Using a Form to Update Multiple Users in a Person Field in SharePoint

    @Alex_10 Unfortunately this puts me back where we started where i go to add a new person to the and then it replaces the whole list with my new selections rather than adding it to the original select list 😞

    Perhaps I need a Flow?

  • Al_10 Profile Picture
    Al_10 1,691 on at
    Re: Using a Form to Update Multiple Users in a Person Field in SharePoint

    @Anonymous 

     

    it looks like for that field you created a custom datacard.

     

    can you try:

     

    - delete the datacard from the form

    - save the app and close it

    - open the app and add the data card from right settings panel 'yourUpdateForm'->Edit Fields->Add Field

     

    that will add a datacard to the form with all default settings, that should prepopulate existing people for existing records

     

     

  • Re: Using a Form to Update Multiple Users in a Person Field in SharePoint

    Hi @Alex_10 ,

    Thanks for your reply! I just tried this and unfortunately this isnt prepopulating the existing people selections when I load the Update form so I cant see the already seected people in the combobox when I reload the app  😞

    Lindsey

  • Al_10 Profile Picture
    Al_10 1,691 on at
    Re: Using a Form to Update Multiple Users in a Person Field in SharePoint

    @Anonymous 

    the default settings when you add a datacard based on a multiselect sp column are: 

     

    DataCard.Update = DataCardValue12.SelectedItems

    DataCardValue12.DefaultSelectedItems  = Parent.Default

     

    that should work and resolve your issue

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,487

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,014

Leaderboard