cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shaikbashu786
Frequent Visitor

Button Click Formula

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!

3 REPLIES 3
v-yutliu-msft
Community Support
Community Support

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,

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.

Hi now the requirement has changed. “RemovedPSCA” column filed has changed from person or group to single line of text. Is that something can you able to help out? Please.

Thanks in advance!

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

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,485)