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

Notifications

Announcements

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard