locked
CRM 4.0 does not delete remove link on 1:n relationship RRS feed

  • Question

  • Hello,

     

    i have the following situation:

     

    I have an custom entity (quote datastorage) with an n:1 parential relationship to the quote entity.

    So i can add multiples datastorage instances to a quote instance.

    Also i have an 1:n referential realtionship between these to entites (qds 1 : n quote).

    So only the link from within the quote should deleted if the quote datastorage entity will be deleted.

     

    My problem is:

     

    I can create a new quote and add a new quote datastorage entity to the quote.

    Then i add the existing quote to the quote datastorage entity.

    (ok, lets say I need this one-to-one relationship)

    Ok, so far so good. If i examine the quote there the lookup to the quote-datastorage instance is set.

     

    But when i now delete the quote-datastorage instance the reference in the quote-datastorage instance will not be removed!

     

    Has anybody an idea of what i am missing or doing wrong, maybe anything with the execution lifecycle?

     

    Thanks

    Frank

     

     

     

     

    Monday, March 31, 2008 9:20 AM

Answers

  • It may be too late for the original poster, but it's not a bug, necessarily.  It's now deletes are being processed by CRM.  When you delete a record, a flag is set in SQL; something like "deletedstatecode" or "isdeleted" is set to true .  Anyway, it then leaves the record around to be processed at the next execution of the scheduled "CRM Deletion" activity (which is a SQL job).  Because the "lookup" is basically a "foreign key" relationship from one table to another, when the "foreign key", which is the "primary key" for the deleted record, is finally removed from the deleted record's table, SQL automatically breaks the connection between the tables.  This is how they rely on the information on the related records to disappear. 

    Unfortunately, the CRM Deletion SQL Job is only scheduled to run once every 24-hours.  Therefore, you will see "dead links" within related entities.  Now, the visibility of this data could be corrected in later Update Rollups, but I don't remember reading about it in patch notes.  I just haven't personally paid attention to this behavior in a long time.


    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com Please follow the forum guidelines when inquiring of the dedicated CRM community for assistance.
    Sunday, December 19, 2010 7:53 AM
    Moderator

All replies

  • Hi Frank,

    I just tried what you mentioned and I see the reference as removed.
    Did you set the requirement level of the relationship as "No constraint"?



    Kunal Bagga
    Founder
    AuraTech Singapore(Custom Software Development, Sharepoint and MS Dynamics CRM customizations)
    Monday, March 31, 2008 10:34 AM
  • Hi,

     

    i set the parential relationship (quote 1 : n quote_datastorage) as "Business required"

    and

    the referential relationship (quote_datastorage 1 : n quote) as "No Constraint" because not every quote has a quote_datastorage. (and i can't set both to business required because one of the instances must exist before creating the other one :-))

     

    Frank

     

    Monday, March 31, 2008 11:33 AM
  • check no constraints.

     

    Regards,

    Imran

     

    http://microsoftcrm3.blogspot.com

     

     

    Monday, April 7, 2008 12:38 PM
    Moderator
  • I have a similar issue using 2 Custom entities.

     

    Custom #1 has a 1:N relationship to Custom #2. The "Referential" relationship is setup as No Constraint since it is not mandatory. If the Custom #1 record is DELETED the link that is referenced in Custom #2 is NOT removed. This will then later through an ERROR if clicking on the link since the Custom #1 reocrd is no longer available.

     

    Has anyone come across this issue before??

    Monday, October 20, 2008 5:22 PM
  • Since it is a 1: N relationship ,Though the Custom#1 record is removed all its references don't get deleted and hence you that error.Try deleting all the records refered by Custom #1.

    Shonai.
    Tuesday, October 21, 2008 11:11 AM
  • That is exactly the problem.

     

    The Cascade Rule for "Remove Link" on a "Referential" and "Cascade, Configurable" relationship on Delete option does not work. I have confirmed this on two seperate instances.

     

    Essentially, if a Parent record that contains Child records is deleted, with the above mentioned relationship, the link to the deleted Parent remains on the Child record.

     

    Yes, we could remove the value on the Child record; however this does not resolve the main issue here. This worked fine in 3.0. I am just now noticing this in 4.0 and I have not yet found a KB article.

     

    Anyone else run into this?

    Tuesday, October 21, 2008 1:29 PM
  • I have the same problem! Have you found a solution? Rollup 2 is installed...
    Friday, March 27, 2009 10:56 AM
  • We have the same problem.  And we're running Rollup 8!!
    anyone found an answer to this bug yet?
    For us, the OOTB Quote is the primary, and we have a custom child entity.
    when we delete an invoice, the child records retain a link to the non-existent parent.
    relationship behavior for delete is set to "remove link".
    dang!
    Wednesday, February 24, 2010 2:34 AM
  • It may be too late for the original poster, but it's not a bug, necessarily.  It's now deletes are being processed by CRM.  When you delete a record, a flag is set in SQL; something like "deletedstatecode" or "isdeleted" is set to true .  Anyway, it then leaves the record around to be processed at the next execution of the scheduled "CRM Deletion" activity (which is a SQL job).  Because the "lookup" is basically a "foreign key" relationship from one table to another, when the "foreign key", which is the "primary key" for the deleted record, is finally removed from the deleted record's table, SQL automatically breaks the connection between the tables.  This is how they rely on the information on the related records to disappear. 

    Unfortunately, the CRM Deletion SQL Job is only scheduled to run once every 24-hours.  Therefore, you will see "dead links" within related entities.  Now, the visibility of this data could be corrected in later Update Rollups, but I don't remember reading about it in patch notes.  I just haven't personally paid attention to this behavior in a long time.


    Dave Berry - MVP Dynamics CRM - http:\\crmentropy.blogspot.com Please follow the forum guidelines when inquiring of the dedicated CRM community for assistance.
    Sunday, December 19, 2010 7:53 AM
    Moderator
  • im having the same issue and its a bug . anyone found a solution ?
    Friday, February 18, 2011 6:47 AM