Multiple relationships between 2 entities
What if I have multiple relationships between my entities, how CRM handles multiple “Relationship Behaviors” (i.e., for example Parental & Referential)
Let’s consider this scenario,
- I have 2 custom entities “Customer” & “Bike” and my requirement is a customer should possess multiple bikes
- I created a 1:N relationship with “Type Of Behavior = Parental” between “Customer” & “Bike”
- Since the relationship behavior is “Parental”
- If I Delete a “Customer” record, all associated “Bikes” get deleted (i.e., Because of ‘Cascade All’ Delete)
- If I Assign a “Customer” to user X, all associated “Bikes” owner change to user X (i.e., ‘Cascade All’ Assign)
Now, just to my curiosity
- I created another 1:N relationship with “Type Of Behavior = Referential Restrict Delete” between “Customer” & “Bike”
- Since relationship behavior is “Referential Restrict Delete”
- I cannot delete a “Customer” record, If its associated with “Bikes” records (i.e., Because of ‘Restrict’ Delete)
- If I Assign a “Customer” to user X, all associated “Bikes” owner does not change (i.e., ‘Cascade None’ Assign)
Now if you see the “1:N relationships” of “Customer“, it will have 2 relationships as below
Let’s try Delete & Assign scenarios and see how CRM application handles Parental & Referential behaviors
Delete Scenario
- I have a customer “Test” with 2 bikes
- Now, lets try to delete customer “Test” and see which of two behaviors (i.e., “Parental” or “Referential Restrict Delete”) applies
- Here I got “Restrict Delete” validation message, so “Referential Restrict Delete” behavior take precedence
Assign Scenario
- When I change the ownership of “Test”
- All my “Bikes” ownership changed to new owner of customer “Test”, so “Parental” behavior take precedence
Conclusion
- In these scenarios, CRM always unions, so in our scenario when I have “Parental” & “Referential Restrict Delete”
- In case of Delete “Cascade All” union “Restrict”, so it restricted the delete
- In case of Assign “Cascade All” union “Cascade None” = Cascade All, so all associated records ownership also change
🙂
Categories: CRM 2011
CRM 2011, multiple, parental, relationship behaviors, restrict delete
Comments (0)
Trackbacks (0)
Leave a comment
Trackback