web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patching updates to mu...
Power Apps
Answered

Patching updates to multiple person field in SharePoint without over-writing

(1) ShareShare
ReportReport
Posted on by 12

Hi community!

I haven't been able to find an answer to this and I have looked, apologies if it is out there.

 

We have a sharepoint list that is being used for an events booking app with a person field for 'Attendees'.

Desired functionality: When Users click a button, it adds their name to the Attendees field, in addition to any names that are already there.

What is happening when using this Patch code below is that it is over-writing what is there, I need it to append...any ideas?

Patch(Training, Gallery1.Selected, {Attendees:
Table({
'@odata.type': "#Microsoft​.Azure.Connectors.SharePoint.SPListExpandedUser",
Department: "",
Claims: "i:0#.f|membership|" & User().Email,
DisplayName: User().FullName,
Email: User().Email,
JobTitle: "",
Picture: ""
})
}
);


Categories:
I have the same question (0)
  • Verified answer
    RusselThomas Profile Picture
    4,014 on at

    Hi @GavSirisena ,

    You're overwriting a table of possibly multiple people with a table of one person.

    The idea would be to get the table of existing people, add your person to it, then write the table back.

    Try this;

    ClearCollect(collectMultiPersons, Gallery1.Selected.Attendees); //collect current attendees
    Collect(collectMultiPersons, //add this attendee to the collection
    {
    '@odata.type': "#Microsoft​.Azure.Connectors.SharePoint.SPListExpandedUser",
    Department: "",
    Claims: "i:0#.f|membership|" & User().Email,
    DisplayName: User().FullName,
    Email: User().Email,
    JobTitle: "",
    Picture: ""
    });
    
    Patch(Training, Gallery1.Selected, {Attendees: collectMultiPersons}) //overwrite the existing table with your collection 

    I'm not sure if there's a more efficient way of adding a single person to an existing list of people, but as the underlying data type is complex, it may in turn be quite complicated.

    Hope this helps,

    RT

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @GavSirisena 

    Please consider changing your Formula to the following:

    With({_itm: Gallery1.Selected, _usr: User()},
    
     UpdateIf(Training, ID=_itm.ID, 
     {Attendees:
     Ungroup(
     Table(
     {Item: 
     Table({Department: "",
     Claims: "i:0#.f|membership|" & Lower(_usr.Email),
     DisplayName: _usr.FullName,
     Email: _usr.Email,
     JobTitle: "",
     Picture: ""
     }
     )
     },
     {Item: _itm.Attendees}
     ),
     "Item"
     )
     }
     )
    );

    This will include the current user in the Attendees Person column while maintaining the existing users that are already there.

    The collection method can be used, but if you're trying to avoid clutter in your app, the above will work without the heavyweight collection as well.

     

    I hope this is helpful for you.

  • GavSirisena Profile Picture
    12 on at

    You're a genius Russel! Thank you very much for this solution, it worked exactly as I needed it to.

  • GavSirisena Profile Picture
    12 on at

    Hi Randy, this also worked really well and was probably a bit faster so thanks a lot!

  • niklasjegg Profile Picture
    511 on at

    Hi @RandyHayes 

     

    this also works fine for me. However i have another question.

     

    I want to Patch all the previous selected users of my Combobox and the newly selected ones to my person column.(Multi selection enabled).

     

    My Combobox Properties: 

    Filter(Office365Users.SearchUser({searchTerm:ExtendedProjectTeam_input.SearchText}),AccountEnabled=true,Not(IsBlank(Mail)),Not(IsBlank(Department)),Not(IsBlank(JobTitle)))

    Default and default selected items are

    LookUp(Request,ID = RequestID).ExtendedProjectTeam

     

     

    With({_itm: varItem , _usr: User()},
     UpdateIf(Request,ID = _itm.ID,
     {memberstest:
     Ungroup(Table(
     {Item:
     Table({ Department: "",
     Claims: "i:0#.f|membership|" & Lower(_usr.Email),
     DisplayName: _usr.FullName,
     Email: _usr.Email,
     JobTitle: "",
     Picture: ""
     })
     },
     {Item: _itm.memberstest}
     ),
     "Item"
     )
     }
     )
    );

     i want to patch these users into a separate column of persons in order to later add them to a team in teams

     

    BR Niklas

  • DirkWellnitz Profile Picture
    37 on at

    Dear @RusselThomas ,

     

    you helped me as well. However, I am struggeling to do the reverse for deletion:

     

    ClearCollect(collectMultiMainContacts, Gallery2.Selected.'Main Contacts');
    
    ClearCollect(deletionIndex, LookUp(collectMultiMainContacts, Claims = "i:0#.f|membership|" & MainContactsDelete.Selected.Mail));
    
    Remove(collectMultiMainContacts, deletionIndex);
    
    Patch(
     'LSO Primary Contacts',
     Gallery2.Selected,
     {
     'Main Contacts': collectMultiMainContacts
     }
    );
    
    
    Notify(MainContactsDelete.Selected.DisplayName & " has been removed from Main Contacts", NotificationType.Success, 5000)

     

    I dont get any errors but the selected Person from 'MainContactsDelete' doesnt get removed.

     

    MainContactsDelete is a combobox with people picker.

     

    May you have an idea. Any hint is appreciated. Thanks, Dirk

  • DirkWellnitz Profile Picture
    37 on at

    Solved. I dont know why but with 

     

    ClearCollect(deletionIndex, LookUp(collectMultiMainContacts, DisplayName = MainContactsDelete.Selected.DisplayName));

     

    it works.

  • jerry86 Profile Picture
    20 on at

    Can I do this for all Share Point List Items , this Specific Column to update? How do i do that? 

  • DirkWellnitz Profile Picture
    37 on at

    Can you be a bit more precise respective provide context what you're trying to achieve?

  • jerry86 Profile Picture
    20 on at

    HI, I am trying to update a full column , Multiple People Column on a hole Share Point List trough powerapps but it seems it's out of my league.

    Eather with power automate i don't find da solution.

    I have a over 12000 Rows SharePoint List and i need to update a Column UserAdmin with the names that i provide in powerapps, os it needs to update theste, lets say 3 Names in a hole 12000Rows. 

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,033

#2
Valantis Profile Picture

Valantis 632

#3
11manish Profile Picture

11manish 607

Last 30 days Overall leaderboard