locked
Deleting Records in Bulk RRS feed

  • Question

  •  

    We've been working in a prototype database, adding custom entities and attributes, modifying forms, etc.  We've also populated several thousand Accounts and Contacts that we'd like to delete, and then repopulate with "real" data.

     

    Is it as simple as setting the DeletionStateCode to 2 in the account and contact tables, and letting the Deletion Service clear them out?  Will this also delete related addresses, Marketing List membership, etc.?

     

    Thanks,

    Peter

    Thursday, September 13, 2007 8:54 PM

Answers

  • You need to stay away from accessing the MSCRM database directly. You should be able to create an Advanced Find or whatever and then directly delete those records. I just tried it here with a couple of test records and it worked a charm.

     

    Friday, September 14, 2007 4:32 AM
    Moderator
  • The biggest problem to trying to do this yourself in the DB is that you might miss the related records and then the Deletetion Service won't be abel to properly delete the records.  Another issue you might face is that some records can't be deleted due to their StateCode value.

     

    If you are OK with doing some direct updates, I would recommend this:

     

    - Update any state codes for "read-only" records (active contracts, inactive accoutns, etc)

    - Either use Larry's aprpoach or some >net code with the SDK to delete all the contacts, accounts & Leads.  This should trickle down to all the related records.

    - There may be some other records types that need to be deleted in this manner, but the above should catch the majority of them due to the cascade nature of a delete.

    - Let the deletion service do it's thing.

     

    Friday, September 14, 2007 4:52 AM

All replies

  • You need to stay away from accessing the MSCRM database directly. You should be able to create an Advanced Find or whatever and then directly delete those records. I just tried it here with a couple of test records and it worked a charm.

     

    Friday, September 14, 2007 4:32 AM
    Moderator
  • The biggest problem to trying to do this yourself in the DB is that you might miss the related records and then the Deletetion Service won't be abel to properly delete the records.  Another issue you might face is that some records can't be deleted due to their StateCode value.

     

    If you are OK with doing some direct updates, I would recommend this:

     

    - Update any state codes for "read-only" records (active contracts, inactive accoutns, etc)

    - Either use Larry's aprpoach or some >net code with the SDK to delete all the contacts, accounts & Leads.  This should trickle down to all the related records.

    - There may be some other records types that need to be deleted in this manner, but the above should catch the majority of them due to the cascade nature of a delete.

    - Let the deletion service do it's thing.

     

    Friday, September 14, 2007 4:52 AM
  • Thanks, guys.  This is what I expected, but I had to ask!

     

    Friday, September 14, 2007 3:08 PM