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 / How to Patch a multise...
Power Apps
Unanswered

How to Patch a multiselect person column in Sharepoint, adding the current user

(0) ShareShare
ReportReport
Posted on by 8

I am doing a Powerapp where I am putting registrations for coming guided tours on a factory site.

One function in this is that I have a number of guides that should get a question thru the app, if they are available on a specific tour, or not. Looking something like this: (Sorry it’s in Swedish)  

 

KriLarLys_1-1649145142413.png

(Selecting the green button if you are available and the red if not)

 

The data is stored in a Sharepoint list, and at the moment the column is a person column. It would be good if it could be that, but if the function I want is not possible with a person column, I could change to something else.

 

My idea is to when the guide clicks the green button, a collection is created with the values already in the column Kan, and then the current user is added to the collection. This I have managed to function with the following code in Onselect:

ClearCollect(colKan,

        {

            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",

            Claims: "1:0#.|membership|" & User().Email,

            Department: "",

            DisplayName: User().Email,

            Email: User().Email,

            JobTitle: "",

            Picture: ""

        }

);

ForAll(

    DataCardValue2.SelectedItems,

    Collect(

        colKan,

        {

            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",

            Claims: "1:0#.|membership|" & ThisRecord.Claims,

            Department: "",

            DisplayName: ThisRecord.DisplayName,

            Email: ThisRecord.Email,

            JobTitle: "",

            Picture: ""

        }

    )

)

 

Then I want to patch this collection into the column Kan again, so the result would be the values that was there from the beginning with the current user added.

I have tried many different ways, but non is working.
At the moment I tried with the following code added after the code above:

Patch(Table(ForAll(colKan), DataCardValue2.Selected))

 

But in this case I get an error message “Invalid number of arguments: received 1, expected 2” regarding the Table function.

 

Is there a way around this or need I change my idea to use a person column?

The complete code under Onselect is at the moment:

ClearCollect(colKan,

        {

            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",

            Claims: "1:0#.|membership|" & User().Email,

            Department: "",

            DisplayName: User().Email,

            Email: User().Email,

            JobTitle: "",

            Picture: ""

        }

);

ForAll(

    DataCardValue2.SelectedItems,

    Collect(

        colKan,

        {

            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",

            Claims: "1:0#.|membership|" & ThisRecord.Claims,

            Department: "",

            DisplayName: ThisRecord.DisplayName,

            Email: ThisRecord.Email,

            JobTitle: "",

            Picture: ""

        }

    )

);

Patch(Table(ForAll(colKan), DataCardValue2.Selected))

Categories:
I have the same question (0)

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 494

#2
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#3
11manish Profile Picture

11manish 323

Last 30 days Overall leaderboard