cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
shaikbashu786
Level: Powered On

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
Community Support Team
Community Support Team

Re: Button Click Formula

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.
shaikbashu786
Level: Powered On

Re: Button Click Formula

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!
shaikbashu786
Level: Powered On

Re: Button Click Formula

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
thirdimage

Power Apps Super User Class of 2020

Check it out!

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,225)