Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Bulk record deletion job deleting from incorrect entity?

Posted on by 1,045

Hi- we have a bulk-record deletion job set up to delete all the records in our Orders entity every night at 11:30pm.  This is part of a nightly reload we perform to repopulate the Orders entity with new records.  The owner of this job is a co-worker we'll call Tom.  Our Sales Reps have begun to notice random Call Reports they have composed are now missing from the system.  They even have emails with links to the Call Report that return a 'Record not available' when you open it, so they are definitely gone.  Looking at the Audit logs, sorting by the Call Report entity, I've found that Tom has been deleting these Call Reports shortly after 11:30pm.  He obviously hasn't been doing this himself so I'm assuming it is related to the deletion job, even though it only queries the Order entity.  As I said, the Call Reports that are deleted are fairly random.  It only appears to occur every few weeks even though the job runs every night.  It typically only deletes one record, but I have a few examples where two were deleted in one evening (both had the same owner interestingly enough).  We do not have any other deletion jobs scheduled either that could be causing it.  Any ideas on what might be causing this?

*This post is locked for comments

  • Suggested answer
    tpeschat Profile Picture
    tpeschat 4,926 on at
    RE: Bulk record deletion job deleting from incorrect entity?

    Hi,

    you are right, if the call report only was linked to the account, this shouldn't have been deleted by your bulk deletion job.

    How often does this deletion happen? You could probably perform some spot checks, if call reports linked to orders exist in the system via advanced find.

    Reg. my proposal to change the search criteria for your bulk deletion job, well this will be quite tricky. Because in advanced find by default you could only search for orders with a related call ceport (related --> call report --> call report contains data).

    But you can't exclude these records.

    In the following post a solution for that has been described (manipulating the fetch XML):

    community.dynamics.com/.../187457

    So you could create an advanced view for that and run the bulk deletion job based on this saved view.

    Hth Thomas

  • JBill Profile Picture
    JBill 1,045 on at
    RE: Bulk record deletion job deleting from incorrect entity?

    I checked with the person who composed a Call Report that was deleted and he tells me he created it via the Account record directly in CRM online.  This Account also has orders that we have pulled in from an outside source (again, we purge and re-build orders nightly).  It's very unclear to me why a Call Report at an Account would be deleted when Orders are purged.

  • tpeschat Profile Picture
    tpeschat 4,926 on at
    RE: Bulk record deletion job deleting from incorrect entity?

    Hi,

    ok then there's no way to change that behaviour. So I would change the search criteria in the bulk deletion to exclude orders, which are linked to a call report.

    Reg. "I would like to point out ...", are these call reports linked to accounts and orders, or only to accounts. If they are linked via the regarding object field, then they are only linked to one entity. So that's the readon they won't be touched when you delete orders.

    Hth Thomas

  • JBill Profile Picture
    JBill 1,045 on at
    RE: Bulk record deletion job deleting from incorrect entity?

    Thank you for responding.  Call Report is an out of box entity, but we actually use a custom entity for Orders.  I'm not sure why we set things up like this.  Call Reports are only generated off of Accounts, Contacts and Opportunities.  Sales Reps can't build them from an order.  Orders and Call Reports are both linked to Accounts.  That is the only connection I see them having.

    Like I mentioned, I can change the type of behavior to Configurable Cascading.  I can then adjust Assign, Share, Unshare, and Reparent, but not Delete or Merge.  Below is a screenshot of the options when I change to Configurable Cascading.  I'd also like to point out that we pull down many orders every night into the Orders entity that are linked to Accounts with Call Reports attached without any deletions occuring so this makes even less sense!

    2604.CRM2.jpg

    Thanks again for the assistance!

  • Suggested answer
    tpeschat Profile Picture
    tpeschat 4,926 on at
    RE: Bulk record deletion job deleting from incorrect entity?

    Hi,

    is "call report" a custom entity you've setup, or do you refer to entity phone call?

    If it should be phone call then the relation between order and phone call could be a system relationship. For system relationships you can't configure the delete behaviour:

    msdn.microsoft.com/.../bb955307.aspx

    "Cascading rules can be configured for most actions. For system relationships, you can select the cascading rules for all actions except merge or delete. For custom relationships, cascading rules can be selected for all actions except merge."

    If it should be a custom entity and custom relation, you should be able to edit the delete behaviour, if you change to configurable cascading. (But you mentioned that this doesn't work).

    You could maybe change the criteria for your bulk delete job, to exclude orders linked to a call report.

    Br Thomas

  • JBill Profile Picture
    JBill 1,045 on at
    RE: Bulk record deletion job deleting from incorrect entity?

    Thank you for the suggestion.  You are probably right on this.  I have opened the N:1 relationship between Call Reports and Orders.  Below is a screenshot of how it is currently configured.  I can't seem to change the Delete option, even when I change the type of behavior to Configurable Cascading.  Am I missing something?

    2656.CRM1.jpg


    Cheers!

  • Suggested answer
    tpeschat Profile Picture
    tpeschat 4,926 on at
    RE: Bulk record deletion job deleting from incorrect entity?

    Hi,

    could it be that the call reports that are getting randomly deleted ould have been linked to orders, that you deleted?

    There coukd be releationships between the order and call report entity with delete set to cascade all.

    Hth Thomas

    (You can check for the relations in settings - customizations - customize the system - entity...)

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans