Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Contact Referential Relationship.

Posted on by 395

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

  • Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 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
    gdas 50,085 on at
    RE: Contact Referential Relationship.

    Which answer you verified? Is it thank you?

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

    Thank you.

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee 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
    Srini20 395 on at
    RE: Contact Referential Relationship.

    Thank you.

  • gdas Profile Picture
    gdas 50,085 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

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans