The blog will help you in the scenarios when you requires to move records from one user to another user with some conditions. Like in scenario one of your sales rep leave the organization and you need to assign his records to the newly joined rep but you also need to keep the history of this old rep (completed work like activities etc) in such scenario you need to check what type relationship behavior is applied in your entity relationship.
The relationship behavior feature of CRM handles action output as per specified settings. Like you can decide major actions Assign, Delete, Share to be handled properly. Say you assigned accounts from one user to another user and in this action you also need to assign all active calls to new user but not need to assign completed call then in such scenario you need to provide relationship behavior of Account-Phone Call entity to Configurable Cascading and set apply rule as “Cascade Active” for Assign action. This will apply changes as per discussed above.
The different type of behaviors provided are,
Parental
o In a parental relationship between two entities, any action taken on a record of the parent entity is also taken on any child entity records that are related to the parent entity record. if you delete a record in the parent entity, the related child entity records are also deleted; or if you share a parent entity record, the related records from the child entity are also shared. All option are disable for Parental relationship
Referential
o In a referential relationship between two entities, you can navigate to any related records, but actions taken on one will not affect the other
Referential, Restrict Delete
o Actions taken on parent will not affect child record but parent record cannot be deleted till the child record exists. i.e you cannot delete a record when related records exist.
Configurable Cascading
o You need to specify your setting here.
The type we are interested here is “Configurable Cascading”. It allows you to decide what type of behavior we need to apply.
The useful details of different cascading rules are (note here me is referred to the user on whom you will perform actions)
• Cascade All: Perform action on all of my child records. Like if assigned my account to another user then all my activities, orders, invoices etc are assign to new user including open, completed and other user owned records
• Cascade Active: Perform action on only my active child records
• Cascade User-Owned: Perform action on all my child records which is owned by me
• Cascade None: do nothing to my child records
• Remove Link: remove link from child record
• Restrict: Applies to Delete. The delete is not allowed if there are other entity instances that reference the ID of the entity instance being deleted.
Marketing4Dynamics – Mailchimp and Dynamics 365 CRM integration to plan effective sales strategies, increase sales and improve ROI
- Sync Audiences, Members and Tags from Mailchimp to CRM
- Sync CRM Marketing List (Contacts/Leads) to Mailchimp
- Sync Campaigns and Member activities from Mailchimp to CRM
- Monitor and analyze Mailchimp campaign statistics through Dashboards in CRM
I want to know RelationshipBehavior = 1 means ‘Parental’, then what about others? how to retrieve others? and how to Distinguish between Parental ,Referential, Referential, Restrict Delete and Configurable Cascading in C# code?
You would need to use Entity Relationship Metadata messages to create or retrieve Entity Relationship metadata. Please refer following articles,
https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/entity-relationship-metadata-messages
https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.createonetomanyrequest?view=dynamics-general-ce-9
https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.messages.createmanytomanyrequest?view=dynamics-general-ce-9
Thanks!