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

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Contact Referential Relationship.

(0) ShareShare
ReportReport
Posted on by 397

I am trying to validate certain condition for a contact delete. Ex: If the contact is associated to an Account then i dont want to delete and show some meaningful message to the user. I was able to implement for single record delete but i need to change in lot of places wherever the Delete buttons are available. There are other buttons exist in system where user can delete a contact. I may need to change all the places or write a Plug-in rather than going with Script.

I tried to setup a new relationship with "Referential, Restrict Delete" so that out of the box alert can throw the message but some how that is not working. Do i need to setup any thing else? Here is the screen shot for the same?

Contact_2D00_Delete_2D00_Referential.JPG

Questions:
-----------

Plug-in is the only best solution or Other than plug-in are there any other solutions available to validate contact delete across the system?

Is there Referential Relationship alert i can setup from out of the box? If so can you validate the screen shot steps and confirm why this is not working?

*This post is locked for comments

I have the same question (0)
  • Alex Fun Wei Jie Profile Picture
    33,626 on at
    RE: Contact Referential Relationship.

    Hi SVN,

    I've rejected your answer. Please verify the post that help you.

  • gdas Profile Picture
    50,091 Moderator on at
    RE: Contact Referential Relationship.

    Which answer you verified? Is it thank you?

  • Suggested answer
    Srini20 Profile Picture
    397 on at
    RE: Contact Referential Relationship.

    Thank you.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Contact Referential Relationship.

    Hi SVN,

    Referential, Restrict Delete will work if you try to delete an account. But if you need to achieve your desired functionality, you need to write a plugin.

    the plugin should fire on delete of contact and check the condition that if account lookup contains data it must throw an error.

    In this way whenever contact is deleted by any means it will fire up the logic and your requirement will be achieved .

    Hope this help :)

  • Srini20 Profile Picture
    397 on at
    RE: Contact Referential Relationship.

    Thank you.

  • gdas Profile Picture
    50,091 Moderator on at
    RE: Contact Referential Relationship.

    Hi SVN,

    Creating only relationship does not restrict the deletion of the contact. By default Dynamics CRM having relationship between Account and Contact is 1:N with parental behavior.  If you create new relationship you need to have the new related field reference (Lookup) in the child (Account ) or account entity.

    Let me give you one scenario , lets say you want to restrict account record deletion if the account having any contact. So in that case  following step you need to follow-

    - Go to Account entity and create 1: N relationship between Account and Contact , choose referential restrict delete.

    - Now by default one lookup will create in Contact entity , that lookup you need to add in the contact form to do the association.

    - Create a contact record and choose the new account lookup value(The related lookup with restrict delete behaviour) for association of account  and save.

    - Coming back to the account records try to delete the account record which you have associated in the new lookup.

    - You will get the error.

    In summary you need to do  the association with new relationship field  which having behavior restrict delete.

    I think for your scenario you can  go for plugin , as creating relationship you need to do additional customization .

    Hope this helps.

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…

Mansi Soni – Community Spotlight

We are honored to recognize Mansi Soni as our August 2025 Community…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans