Hi
I have a column called PSCA its a Person or a group field enabled multiple selection to Yes and another column called Removed PSCA's its also a person or group field enabled multiple selection to Yes.
I have button called Remove PSCA, when the user clicks on the Button (Current logged in user) it should remove from PSCA column and Add to the Removed PSCA's Column. is that something make sense? if yes help will be greatly appreciated.
Thanks in Advance!
Hi @shaikbashu786 ,
Could you tell me which item that you want to justify the value of person field?
Do you want to if current user is in the PSCA field, when you click the "Remove" button, the current user's value will be removed from PSCA field and be added in Removed PSCA field?
Firstly, it's not supported to remove one value in a multiple person field directly.
So I save the original data of the multiple person field as a collection, update this collection and then use this collection to update the multiple person field.
Based on your description, I've made a similar test:
I assume that you want to justify First item, so I use First(listname) to represent the item that I update.
1)save the data in the multiple person fields as a collection
you could set this one this screen's OnVisible:
ClearCollect(newPSCA,AddColumns(First(list5).PSCA,"'@odata.type'","#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser"));
ClearCollect(newremovePSCA,AddColumns(First(list5).'Removed PSCA',"'@odata.type'","#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser"))
Please note that the person field's structure is like this:
{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|michael@wiXXXX.onmicrosoft.com",
Department:"",
DisplayName:"Michael Shao",
Email:"Michael@wiXXXX.onmicrosoft.com",
JobTitle:"",
Picture:""
}
So you need to shape the collection to this structure. (use AddColumns function)
2)set the remove button's OnSelect:
Collect(newremovePSCA,
{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims:"i:0#.f|membership|"&User().Email,
Department:"",
DisplayName:User().FullName,
Email:User().Email,
JobTitle:"",
Picture:""
});
//add current user's information to newremovePSCA collection
Remove(newPSCA,LookUp(newPSCA,Email=User().Email));
//delete current user's information
If(User().Email in First(list5).PSCA.Email,
Patch(list5,First(list5),{PSCA:newPSCA});
Patch(list5,First(list5),{'Removed PSCA':newremovePSCA}))
//update PSCA with the data of collection newPSCA
update 'Removed PSCA' with the data of collection newremovePSCA
Please note that list5 is my listname, you need to replace it with your listname.
You also need to replace First(list5) with the item that you want to update.
Best regards,
Hi @v-yutliu-msft now the requirement has changed. "RemovedPSCA" column field has been changed from "Person or Group" field to "Single line of text". Is this some can you able to help me out? please.
Thanks in Advance
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
185 | |
53 | |
41 | |
37 | |
31 |
User | Count |
---|---|
246 | |
75 | |
71 | |
69 | |
65 |