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 / How to delete in batch
Power Apps
Unanswered

How to delete in batch

(0) ShareShare
ReportReport
Posted on by 5

Hello, I am a newcomer to Power Platform. I plan to fulfill the requirement of batch deletion. To be specific, I would like to write a plugin with c# in Visual Studio. I provide a template with the column including the product ID, terminal ID, external ID, and operation to users. The user can export the template. When a user writes "D"(stands for delete) in the column of operation. It will trigger our plugin to delete the corresponding record. And then, the user can import the excel to dataverse(CDS). My question is how to write the plugin. Could you please give me some hints or references. Appreciate your help.

I have the same question (0)
  • Verified answer
    ChrisPiasecki Profile Picture
    6,422 Most Valuable Professional on at

    Hi @James_Baibai,

     

    Have you assessed the true need to allow your users to bulk delete? Once the records are deleted they are gone, the only way to retrieve the data is if auditing was enabled on all the fields or if you restore from a backup, which only retain up to 7 days for production databases. I find that it's much safer to deactivate records once they are no longer required. That said, if you want to allow Bulk Deletion, you should have a look at out of box Bulk Deletion jobs to see if it can meet your needs. If you don't need the records to be deleted in real time / near-real time, you could setup a bulk deletion job to run nightly to delete records based off criteria you define. In your example you could have the users set a certain status on the records and import those updates back into Dataverse, then your next bulk deletion run would delete those records based on the status. The benefit of this is that you don't have to grant those users delete permissions, reducing risk of inadvertent deletion, but still provide a controlled process to actually delete the records. 

     

    There is also the Bulk Data Updater for the Xrmtoolbox which allows you to bulk delete using views and FetchXml queries. 

     

    If you still prefer to write your own code to do deletion, you can refer to this reference on how to achieve this using the .NET SDK. 

     

    ---
    Please click Accept as Solution if my post answered your question. This will help others find solutions to similar questions. If you like my post and/or find it helpful, please consider giving it a Thumbs Up.

     

     

     

  • EricRegnier Profile Picture
    8,720 Most Valuable Professional on at

    Hi @James_Baibai, as @ChrisPiasecki mentioned, bulk delete jobs would be the way to go with out-of-the-box capabilities and no code. You can schedule the job to run nightly (or even more frequently) based on the "D" column. Cheers

  • Fubar Profile Picture
    8,338 Super User 2025 Season 2 on at

    As per the others, sounds like a job for bulk delete - unless you need it removed immediately (i.e. not on a schedule).

    Personally, I would include a field (probably what you are referring to as the operation), and another Status Reason 'Delete' to the Inactive status, and have a Workflow or Flow trigger on update of that field and set the record set the record to the Delete status reason.  Then run a bulk delete job to remove all records with status reason = Delete (nightly etc).  The benefit of the new status reason, is that if provides time for someone to realize they made a mistake and undo it - as deleting is removing permanently.

    https://docs.microsoft.com/en-us/power-platform/admin/delete-bulk-records

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