cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

How to add and remove user from multiuser field

I have a SharePoint List where I have one title column and one people picker column which is enabled for multiple selection. My SharePoint list have only single record in that my people picker column values are "A" and "B". I want to design a form in the PowerApps so that I have two button "Add my name" and "Delete my name". When logged in user will click on the "Add my name" his name will update to the "PowerApps people picker". It should not save as a new record. So now my people picker value is "A","B" and "my logged in user name". Like that when user will click on the "Delete my name" then my logged in user name should delete friom the people picker record.Is it possible. I just want to update my logged in name in the people picker field first record. My aim is not to add as a new record. In a single record only I want to update and delete my value.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @Anonymous ,

Try this:

1)add current user:

ClearCollect(DemoColl1,LookUp(MultiUserDemoList,Title="A").EmployeeName);
Patch(DemoColl1,Defaults(DemoColl1),{Claims:...,Depatrment:...,DisplayName:...,.....});
Patch(MultiUserDemoList,LookUp(MultiUserDemoList,Title="A"),{EmployeeName:DemoColl1})

2)delect current user:

ClearCollect(DemoColl1,LookUp(MultiUserDemoList,Title="A").EmployeeName);
RemoveIf(DemoColl1,DisplayName=User().FullName);
Patch(MultiUserDemoList,LookUp(MultiUserDemoList,Title="A"),{EmployeeName:DemoColl1})

 

Best regards,

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Highlighted
Community Support
Community Support

Hi @Anonymous ,

Since person is a complex data type, I'm afraid it's not supported to change its value by using button.

For now, you could only use combo box to select value to update person field.

I've made a test and found that patching value by enter value by yourself will not work:

ClearCollect(test,ComboBox1.SelectedItems);
Patch(test,Defaults(test),LookUp(Choices(survey.peo),DisplayName=User().FullName))

Combo box is the control that displays person field value.

survery is my list name, peo is my person field.

And the result is:8306.PNG

 

So, I suggest you just using combo box to update person field, not using buttons.

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Anonymous
Not applicable

Thnk you soo much for reply. Sorry I didnot explain properly. I will give the screenshort so that I can explain my requirment .

detaily. Below is SharePoint list having two column one is title(default) and other one is people picker(enable multi selection in SP List)or "EmployeeName". I have a single record in SharePoint list.

Pic1.png

I have a PowerApps form where in the "Add" button control add the below rule. To save the logged in user name save to SharePoint multiselected people picker field(Employee Name).


PowerApps add buttonPowerApps add button

My logged in user name is Padmini so it is working fine. But now I have open the PowerApps form with other user name and click on the Add button. See in the below screenshort other name is saving.

But my requirment is I want to append the other user name in the EmployeeName column where title value is A. So I want in the "Employeename" column should display "PadminiKumari","PreetiSahu".

Like that when the other Office365 user will open the PowerApps form and click on "Add" then his logged in user name  suppose "xyz" should come in the "EmployeeName" column where title value is "A". Now I want my list column employee name should "PadminiKumari","Preeti Sahu" and "XYZ" as a single record.

Pic3.png

If you have any solution please share with me. 

I have one more requirment like add I want one more button in the powerApps form called delete. When logged in user click on it his his name will delte from the "EmployeeName" first record where title value is "A".

For example my logged in user name is padmini. I have opened the "powerApps" form using my credential and click on the "delete" button so my name should delete from the record, now my people picker have "Preeti" and "xyz".

Please help me to achieve my requirment

 

 

 

Highlighted

Hi @Anonymous ,

Try this:

1)add current user:

ClearCollect(DemoColl1,LookUp(MultiUserDemoList,Title="A").EmployeeName);
Patch(DemoColl1,Defaults(DemoColl1),{Claims:...,Depatrment:...,DisplayName:...,.....});
Patch(MultiUserDemoList,LookUp(MultiUserDemoList,Title="A"),{EmployeeName:DemoColl1})

2)delect current user:

ClearCollect(DemoColl1,LookUp(MultiUserDemoList,Title="A").EmployeeName);
RemoveIf(DemoColl1,DisplayName=User().FullName);
Patch(MultiUserDemoList,LookUp(MultiUserDemoList,Title="A"),{EmployeeName:DemoColl1})

 

Best regards,

 

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Anonymous
Not applicable

Thank you soo much 

Best regards

Highlighted

Not working. It says, "Claims column does not exist"

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,329)