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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / PowerFX Remove() doesn...
Power Apps
Unanswered

PowerFX Remove() doesn't remove all items from collection - Model Driven App - Button

(0) ShareShare
ReportReport
Posted on by 6

Dear all, I have crafted a new button "Remove All" on Quote form (D365 Sales -  Model Driven App) using PowerFX Command.

 

It works quite well, but recently I was surprised to see that not all the records are deleted. 

The command is:

If(Confirm ("Are you sure?",{ Title: "Remove All Quote Products ?", Subtitle: "This action will remove all products from the quote", ConfirmButton: "Yes", CancelButton: "No" }), Remove('Quote Products', Self.Selected.Item.'Quote Products',RemoveFlags.All);Refresh('Quote Products'))

 

I use the RemoveFlags.All ... which is as per documentation - isteadof deleting 1 reocrd, it deletes all records. 

The problem is that success is not 100%. Sometimes I need to press the button twice to have all the Quote Products deleted. It looks to me as implementation bug. 

 

Any other thought - suggestion ?

Categories:
I have the same question (0)
  • SoPatt Profile Picture
    Microsoft Employee on at

    It deletes all records that match your record exactly. If you want to remove all records from a collection, Use Clear('Quote Products') or if you want to remove all records that match a filter, use RemoveIf().

  • DanielBurian Profile Picture
    6 on at

    Thank you. It shouldn't however ... since I refer to a collection of the Quote Products as part of the Quote (which the form is at) ... Self.Selected.Item.'Quote Products' ... so there are no "matches" involved ... . 

     

    And it works ... 95% .. it deletes all the products ... like 10 or 15 ... but sometimes if fails and 1 or 2 products are not deleted. So I press button seond time and rest is gone. 

     

    I will test the Clear and let you know.

  • DanielBurian Profile Picture
    6 on at

    Clear is unfortunately not currently supported in model-driven apps.

     

    Use Power Fx with commands - Power Apps | Microsoft Learn

  • SoPatt Profile Picture
    Microsoft Employee on at

    RemoveIf('Quote Products',true)

  • DanielBurian Profile Picture
    6 on at

    Tested. Unfortunately, it doesn't do any better. Even worse, while the previous command was always refreshing the Opportunity Products grid correctly, this RemoveIf takes a lot longer and refresh is not fast or even not coming at all. 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard