Entity Relations and its behaviors with scenarios

Entity relationship plays a major role in any data and same is with D365 as well. I have tried to consolidate various scenarios which will be relevant in current Power platform as well. Hope this would help to get more clarity on how to decide when, what and how entity relationships can be used in dynamics CRM implementations.

We can definitely go through the Microsoft Docs for the detailed information

Opportunity has parental relationship with account and opportunity has line items. If account is assigned to another user, will that user see opportunity line items? Yes , Opportunity line items are automatically assigned to the same user as its has cascade all

User 1 belongs to BU1. User 2 belongs to BU2. Account is owned by User 1 Opportunity has parental relationship with Account. If Account is assigned to User2, what will happen? User 2 will be able to see the opportunity. It has CascadeAll for assign in opportunity – account as well as Opportunity- opportunity line item

You plan to entity mapping to replicate data from a text field between two related entities. This scenario has nothing to do with N:N relationship, only the length of the source field is smaller than the destination field

Your company rents tools and machines to customers. You create a custom entity named Equipment to track the tools and machines. You need to show the hierarchical relationships between various pieces of equipment. Here its only talking about customers, however the relationship is required for Equipment’s and its pieces , hence we should create a self-referential relationship and configure hierarchy settings.

You configure a 1:N relationship between two entities and set the cascade rule for deletion to Referential. Since this is referential cascade rule, the nothing will be cascaded down to child records. If we delete the parent record, the child records remain but the link to the parent record is removed.as the parent is deleted

Ref link Neil Parkhurst’ blog

On an Opportunity. you need to show Stakeholder, Products. Competition, and Sales Teams related to the Opportunity. The relationship between the related record and the Opportunity is automatically set when selecting a related record from within the Opportunity form

You are setting up a Product Catalog in Microsoft Dynamics 365 for a company selling laptops and accessories. When a laptop is added to an Opportunity, a travel case should be suggested as an accessory, but a laptop should not be suggested as an accessory to the travel case. We should set up on the product record for the laptop, add a uni-directional relationship of the type accessory to the travel case product record.

You are creating Word Templates for a customer using Microsoft Dynamics 365. The customer needs a Word Template for the account entity and wants to merge data records related to the account. We can include records related in 1:N. N:1. and N:N relationships in the Word Templates

You need to model a relationship between the account entity and the contact entity to track the advisory board members of accounts. You need to use connections to model the relationship between the account and contact entities. We should use two connection roles to represent each side of the relationship.

You plan to create a country entity that contains one record for each country in the world. You need to track which countries a contact visited. No additional data will be tracked. We should create relationship like a many-to-many (N:N) relationship from the contact to the country as a contact can visit multiple countries and a country can be visited by more than one contact.

You are configuring a many-to-many (N:N) relationship. You are evaluating whether to use the native N:N relationship or the manual N:N design pattern. You need to identity the benefits of using the manual N:N design pattern instead of the native N:N relationship. Manual N:N provides the ability to report on the intersect data and Manual N:N provides the ability to store Felds that describe the relationship.

You need to model a relationship between the account entity and the contact entity to track the advisory board members of accounts. You need to use connections to model the relationship between the account and contact entities. In this case the connection roles would be solution. We should use two connection roles to represent each side of the relationship.

Business Rules Key Notes

Business Rules, always had love and hate relationship for this feature as a typical developer. mindset, instead of creating step by step business rule using the UI, it would be quick to write a javascript 😊 Having said that from architectural perspective, Microsoft recommends to use the business rules as a first preference for any validation or conditional logic.

When we think about business rules, actually there is no trigger which we can select, It gets triggered based on the change of the field on the form. Visually we can think that business rule is running on the save of the form, but it actually gets triggered on the change of the field used in the condition.

As I wrote above about the trigger, when we want to trigger the business rule on Save of the form, we can not select the trigger, but we can select the scope of the business rule as Entity which would run the business rule on server side and on the save of the form. Lets talk about the scope of the business rule. Scope can be either single form, all forms or entity.

Let us check the below scenarios.:

You create a business rule for the Account entity.

The business rule must run when you import account records. Then the Scope should be set to Entity and business rule should be active

You create a business rule for the Case entity and set the scope to Case. The business rule will run when the form will get loaded and at the change of the field as well

In Business rules , we can perform these actions : Subtract $5.00 from a currency field, Concatenate two text fields, Add six days to a date field. However we can not directly clear a two options field(this is by design as a binary field, either one value should be defaulted to two option field. On another note we can definitely clear the optionset field in the business rule

You can add max 10 number of If-Else conditions to a business rule?

When we need to create a business rule for the account entity that runs both client and server side. Then the business rule scope should be Entity

Hide a section, Show an error message when a rule fails to run ,Hide a tab are not valid business rule use cases , however Show an error message when a condition is met is a valid business rule scenario.

If we create a business rule for the Account entity. The business rule must run when we import account records. Then below are correct conditions The scope was set to Entity and A business rule is active. Snapshot is just pictorial representation of the business rule flow

Which three statements regarding form design or behavior for the mobile phone or tablet application are true? Here are the steps presenting a complete solution. Activities can be modified, tabs do not have the expand and collapse capability, If business rules are changed while the mobile app is open, the app must be closed and reopened for those changes to apply.

You are creating a business rule for the account records. The business rule will perform an acton if the record has country set to the United States and City set to either Redmond or San Francisco. You need to identity the minimum 2 number of condition sets required to implement this logic. We can add multiple rules in a condition, but all can be And or OR, we can not And for country and Or or both cities , hence we have to add minimum 2 conditions for above said conditions

You create a business rule that has a Set business required action for a field. The action has a Status of Business Required when a condition is met. Users report that when that change the value so that the condition is false the Feld is still required. You need to ensure that the field is required only if the condition is true. Then we have to create an Else statement that has no conditions and a Set business required Acton. Configure the action to have a Status to Not Business Required.

You need to implement a process. The process must perform the following:

  • Run when a new account is created.
  • Make changes to the account as the user who created the account
  • Send an email message to the account as the owner of the account. This must be a different user than the user who created the account.

Again this is not a business rule use case . This should be implemented by workflow

You have a business rule that has a scope of All Forms. You discover that the business rule does not execute on forms when users access the forms. You need to ensure that the business rule executes on the forms when accessed bt the users. We need to make sure that the business rule is activated

On the contact entity you are creating a business rule that has the Set visibility action. You need to identify which form elements you can control by using the Set visibility action. We can set visibility only for the form fields in the business rule

You have a custom entity named Event Registration. Event Registration has a relationship with the contact entity. You plan to add a field named Contact Phone to Event Registration. You need to ensure that when a contact is added to an Event Registration record, the phone number of the contact is displayed in the Contact Phone field of the record. If the contact changes the Contact Phone field must display the new phone number of the contact. This is not a Business rule use case. This can be achieved by a calculated field