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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / remove function does n...
Power Apps
Answered

remove function does not work in sharepoint list (isnt delegable?)

(0) ShareShare
ReportReport
Posted on by 14

Hello, I have created a survey application, and I send the results to 2 sharepoint lists. 1st list has a unique record of the user with some header data (name, role, department) and a field IDSurvey = GUID(), and a 2nd list where I keep a record for each response to the survey questions and each record will I record the same IDSurvey = GUID().
List1: User1Name (more than 2k records)
List2: Record1, Record2, Record3. (more than 50K records)

guille_0-1676167058605.png

List1: "CuestionariosBAI" (header list)
List2: "ResultadosBAI"l (ist with answers)

Set(varSpinner2;true);;Remove(ResultadosBAI;Filter(ResultadosBAI;'Creado por'.Email = varUserEmail;IDRESULTADOS = ThisItem.IDCuestionario));;Remove(CuestionariosBAI;ThisItem);;Set(varSpinner2; false)

The problem I have is that when I use the REMOVE function on another screen where I have a gallery, it doesn't work correctly, according to the documentation remove is delegable unlike RemoveIf which is not, that's why I used REMOVE with FILTER to reduce the records by user. And I have placed the user's email in a variable, because I also know that it cannot be delegated. I have tried several ways to change the formulas to make it delegable but it doesn't work for me.

Set(varSpinner2;true);;Set(varIdEliminar;ThisItem.IDCuestionario);;Remove(ResultadosBAI;Filter(ResultadosBAI;'Creado por'.Email = varUserEmail;IDRESULTADOS = varIdEliminar));;Remove(CuestionariosBAI;ThisItem);;Set(varSpinner2; false)

 

I even thought that I should put the IDSurvey in a variable, so I changed that too.

et(varSpinner2;true);;Set(varIdEliminar;ThisItem.IDCuestionario);;Remove(ResultadosBAI;Filter(ResultadosBAI;IDRESULTADOS = varIdEliminar));;Remove(CuestionariosBAI;ThisItem);;Set(varSpinner2; false)

I changed to 5 records in the settings to test it, and it only deletes me the 5 records, but not the 20 that are in list 2 of the user survey responses, however it did delete me from list 1.

It looks like it has to do with delegation, but I am using delegable functions, please help.

Categories:
  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @guille ,

    Try this

    Set(
     varSpinner2;
     true
    );;
    RemoveIf(
     ResultadosBAI;
     'Creado por'.Email = varUserEmail &&
     IDRESULTADOS = ThisItem.IDCuestionario
    );;
    RemoveIf(
     CuestionariosBAI;
     ID = ThisItem.ID
    );;
    Set(
     varSpinner2; 
     false
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • guille Profile Picture
    14 on at

    Thank you for your answer, but it was only deleted in the "CuestionarioBAI" sharepoint list, but not in the "ResultadosBAI" sharepoint list, the same thing happens with REMOVE. I thought it's because of non-delegable functions as shown in the image, that's why I thought I shouldn't use REMOVEIF and should use only REMOVE and FILTER, but it doesn't work with the latter either.

     

    guille_0-1676176025377.png

    I show the monitor, in case it can help.

    guille_1-1676176967665.png

     

  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @guille ,

    RemoveIf() is only non-Delegable to the extent it will not remove more than 500-2000 (depending on your Delegation limit) records. Subject to this limit, this code

    RemoveIf(
     ResultadosBAI;
     'Creado por'.Email = varUserEmail &&
     IDRESULTADOS = ThisItem.IDCuestionario
    );;

    will remove up to 500 records (or more if your limit is higher) records from ResultadosBAI where 'Creado nor'.EMail (a Person field) matches the logged in User AND IDRESULTADOS is equal to IDCuestionario in the current record (I assume you are running this from inside a Gallery)

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • guille Profile Picture
    14 on at

    Hi @WarrenBelz ,

    hello, after all the users registered their surveys in a gallery, with 2 patches I registered the information in 2 Lists "CuestionariosBAI" that contains approximately 4K records, and "ResultadosBAI" that contains more than 50K records, this exceeds 2k of delegation settings. So now I reduced the delegation limit to 5 records as a new limit just to test my functions.

    Then in this gallery, I bring only the "CuestionariosBAI" list, which contains a summary of the user's data with an ID, and the option to delete this record and at the same time can delete the associated records in the other "BAI Results" list to the same custom code that I created with the GUID() for both.

    guille_1-1676209480967.png

    I have used the functions that you have indicated, but I cannot delete the 2nd list "ResultadosBAI" the records associated with the same code of the record that I am deleting in the list "CuestuionariosBAI" with the trash icon.

    guille_2-1676209559326.png

    In the image of my previous message I showed the monitor where it can be seen that the Remove function does not happen to the "ResultadosBAI" list, but it does to the "CuestionariosBAI" list, I do not understand why this happens.

     

  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    @guille ,

    This is overkill, but try

    With(
     {
     wDel:
     Filter(
     ResultadosBAI;
     'Creado por'.Email = varUserEmail
     )
     };
     RemoveIf(
     ResultadosBAI;
     ID in wDel.ID
     )
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

     

     

  • guille Profile Picture
    14 on at

    Hello, the examples only deleted records obtained within the delegation limit, which for testing purposes changed it to 3 records (but in production the data can contain more than 50k), however my result list should have deleted 20 records. According to the activity monitor, it was only evaluated in the 3 records it obtained. Can't skip delegation?

     

    guille_1-1676235616861.png

    guille_2-1676235819028.png

     

  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @guille ,

    Yes that is correct and the expected result - if you put it back to 500, it will delete up to 500 matching records. As I mentioned, only the output is subject to Delegation (not the choice of records selected)

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • guille Profile Picture
    14 on at

    If I wanted to delete record 501 (limit 500), or record 2001 (limit 2000), is there any other way to do it? I thought that using functions that allow delegation like filter would allow it, but in Previous tests did not obtain a favorable result.

  • Verified answer
    WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    @guille ,

    You should be able to delete up to 500/2000 records from your dataset - the filter (which is Delegable) runs first to select the records and then they are referenced and deleted. I just ran a test here with the second code I posted

    With(
     {
     wDel:
     Filter(
     ResultadosBAI;
     'Creado por'.Email = varUserEmail
     )
     };
     RemoveIf(
     ResultadosBAI;
     ID in wDel.ID
     )
    )

    with a Delegable filter and deleted about 50 records spread all over a 10k SharePoint list.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard