Understanding Business Rule in Dynamics 365.
Hello Guys,
In our previous blog we have seen Activity Table. Today we are going to explore Business Rule.
Do follow us to know more about Dynamics and Power Platform. Also if you like our blog then please comment and share this blog with your friends.
Business rule is one of the important feature of Microsoft Dynamics 365 which allows us to implement conditional functionalities like validation and pre-filled which can be attach to the column on forms without writing a code.
Business Rule helps user to implement validation on form using drag and drop component. Consider a scenario where we have Employee table and we want to validate employee's basic information. To achieve this we were writing some JavaScript code in the previous version of the CRM. But from when Business Rules have been introduced, its easy for user to implement form validation without writing code.
You can perform below actions using Business Rule.
- Set field values
- Clear field values
- Set field requirement levels
- Show or hide fields
- Enable or disable fields
- Validate data and show error messages
- Create business recommendations based on business intelligence
While creating a business rule we need to specify the scope of the business rule which can be either entity(Table) or All forms or a specific form. When it is an entity it executes at server side which means this rule fires whenever a new record(row) is created or saved from the form inside the CRM or from any web application.
When the scope of business rule is All forms or specific form, then it will be executed at client side which means business rule get fired when form is loaded or updated at the client CRM form.
While working with business rule, we have some limitation of business rules.
- Business rules don’t work with multi-select option sets.
- They are not executed while performing bulk imports and edits.
- We cant debug business rules like we do with JS code.
- Business rule can not call any JS code function.
- Business rules are executed in the order they activated.
- You can create only 10 if...else block in business rule.
- We cant control the execution of the business rule which means if you write a JavaScript code and business rule for same column, then the priority of the execution is System JavaScript then Custom JavaScript and then Business Rules.
Navigate to https://make.powerapps.com and select your environment.
Now open the solution and open your table.
Now click on Business rule and click on Add Business Rule. This will open a new tab as shown below:
Now select the new business rule and specify the name of the business rule and scope as entity.
Now select the condition and configure it as shown below. Once done click on apply.
Now click on components and drag Show Error Message block and configure it as as shown below:
Once done click on save and validate and activate. Now open the Employee form and try to create a new employee row without specifying first name value. You will be getting an error as shown below:
Hope it helps...
Comments
Post a Comment