Saturday, February 28, 2015

CRM Delete Plugin Message - Relationship record deletion

When  you are deleting a record in CRM you might have had a requirement to delete it's relationships as well with other records. How would you do this?

Is it Pre Delete message in CRM that would work with this or Post Delete message?

The answer in none of them would work. When the plugin starts executing any of the previous messages then by that time the deleted records would have dropped all the relationships with other records. This means you are no longer able to query the related data.

So is there a way to achieve this, and the answer is Yes, there is.

You can use pre valiation before deletion to be executed and this would do the trick. Please note the message pipeline for this is 10.

You can achieve what we set to achieve from this message when a record is deleted.

No comments:

Post a Comment

Retrieving Calendar of a Bookable Resource in Dynamics

There are occasions where we need to retrieve working days and working times of a resource in Dynamics grammatically. This is quite possible...