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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Plug-in to delete records

(0) ShareShare
ReportReport
Posted on by

I need to write a retrieve plug-in to delete some records every time the user clicks on an account. I'm usingBulkDeleteRequest from the SDK but it seems like this request is fired after the user clicks on an account. Is there any other/better way to delete records (that match some criteria) before the account page is loaded? Thanks a lot.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Aiden Kaskela Profile Picture
    19,696 on at

    Hi,

    I would configure a Retrieve plugin on the Account entity that runs synchronously. This should run when CRM attempts to retrieve the account and before it's opened. It'll slow down your form load a touch but it shouldn't be noticeable unless you're deleting a lot of records.

    Hope this helps - if so I would appreciate if you would mark this as the verified answer.

    Thanks,

     Aiden

  • Community Member Profile Picture
    on at

    Hi,

    Thanks for your reply. I did register the plug-in to run synchronously but usingBulkDeleteRequest is asynchronous anyway (according to the SDK). Is there any other way to bulk delete records in code?

    Thanks.

  • Verified answer
    Aiden Kaskela Profile Picture
    19,696 on at

    You can query for the records you want to delete, then make a single call using the ExecuteMultipleRequest message. You would build Delete Requests for each entity, but you send them all to the server at the same time.

    Check out this link for more details and examples:

    msdynamicscrmblog.wordpress.com/.../use-executemultiplerequest-for-bulk-createupdatedelete-using-c-in-dynamics-crm-2011-2

    The old school way to do it would to just loop through and delete one at a time. If you are using a small data set, this won't be too bad either.

    Hope this helps!

     Aiden

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans