Entity Relationship Behavior in D365 CRM
When a user changes the owner of Lead (either because the original owner has left the company or the lead is being assigned to a new salesperson), the system changes the owner on COMPLETED activities to the new owner of the record.
This is a problem because it is important that we maintain the history as to who performed each task that happened in the past and by switching the owner for completed tasks this changes all historical reporting and records.
This kind of situation can be easily handled by using the relationship behavior feature in D365 CRM.
- Create a new solution->> add the Activity Entity for which you need to make this change. (in below example I have added the Email entity).
- When you open the relationship, you will notice that the behavior is set to Parental. Parental Relationship: In this relationship all changes on parent record are reflected on child record.
- Change the type of Behavior to Configurable Cascading. This will enable the Assign\Share\Unshare\Reparent actions which were earlier set to Cascade All as the relationship was Parental.
For our problem Statement where we will be making changes to owner, we will be using changing the Assign Action.
Below are scenarios handled by Assign Action in relationship feature (On Change of owner)
Scenario 1:Cascade-None: No change will be done to existing Activities and Notes. No change on Child will be done if Change in Parent.
Scenario 2:Cascade-Active: Only Open Activities will be updated to the new owner and date changed to date of change of owner. This option is not available for Notes, as notes are always active.
Scenario 3:Cascade-All: Changes on the parent will be done on the Child.
Scenario 4:Cascade-User-Owned: Changes on parent will be reflected on child records owned by the same user.
As for our requirement, we will make it cascade active(Scenario 2)
Below is an example for the same.
a. Before Change of Owner, we can view the last updated Datetime of activity.b. After Change of Owner, we can view the last updated datetime of activity.
As desired, The Date-time and owner is updated for open activity. (Since I have tried all the cascade options on the same Date, in my example you will be able to see change of time and not Date).
Conclusion: By using the relationship behavior feature, we can maintain historical data even on changes done to parent record (change of Owner).