Dynamics 365 News • 25 January 2020
Using Dynamics 365 without Code: Business Rules
Dynamics 365 can do a lot of things. But you don't necessarily have to be a coding expert to develop it.
Fabric IT
Dynamics 365 can do a lot of things. But you don’t necessarily have to be a coding expert to develop it.
Depending on your business requirements, there may well be occasions where you need to add dynamic behaviour to a particular entity form. While custom JavaScript can be written to accommodate such behaviour, Microsoft offers a simple interface for this, known as Dynamics 365 business rules. Business rules accommodates for some of the more basic dynamic behavioural requirements without the need to develop any custom code.
Some of the capabilities of business rules are as follows:
Business Rules Capabilities
Conditions
Conditions allow you to control which subset of business rule actions (see below) are enforced based on the current value of one or more current field values. It should be noted that the nesting of business rules is restricted to 5 levels deep. While this should be more than sufficient to facilitate some of the more basic form dynamic behavioural requirements, anything outside of this limitation will require the use of custom JavaScript.
Actions for Dynamics 365 Business Rules
Actions allow you to control an entity form in a variety of ways dynamically.
Here are the actions which are currently available on business rules:
1. Recommendation
Presents a recommendation notification against the specified field, with the specified recommendation text displayed to the end-user. This particular action is primarily designed to assist the end-user while inputting data within the entity form. Below is an example of a recommendation pop up notification.
2. Lock/Unlock
This action allows you to lock or unlock a field. Locking a field greys it out on the entity form, thus preventing the end-user from updating its value. This might be useful if you want information in a field visible but as read-only for the end-user.
3. Show Error Message
This action displays an error notification against the specified field, with the specified error text displayed to the end-user. The entity form cannot be saved until the error has been rectified. This can be used alongside number 6, the ‘set business required’ action, where a field is required to be filled in so an end-user is unable to submit the form without doing so. With ‘show error message’ they will see a red ‘X’ next to the field which requires attention.
4. Set Field Value
The ‘set field value’ action allows you to update a field to a static value or even set it to match its value with another entity field. The set field value action also enables you to clear a particular field as required.
5. Set Default Value
By using ‘set default value’, you can specify a default value for a field for when no value is added.
6. Set Business Required
This action will mark a field as being mandatory or optional. You’ll be familiar with forms using ‘*Required’, this is the same thing. The entity form cannot be saved until a mandatory field has been specified.
7. Set Visibility
It allows you to show or hide a specified field. This may be where a field doesn’t need to be edited but needs to be there for another purpose.
Scoping business rules on Dynamics 365
Business rules can be scoped so that they only take effect on either a particular entity form or all entity forms for a particular entity. They can also be scoped at the entity level, which means that, in addition to all entity forms, they will also take effect for other non-form-based entity transactions.
Are Dynamics 365 Business Rules better than coding?
Business rules are a powerful, convenient way to introduce custom entity form behaviour without the need to introduce any custom code. It should be noted that business rules are primarily geared towards the more basic end of entity form dynamic behavioural requirements. Custom JavaScript coding is still a fallback option for some of the more complex requirements. Nonetheless, business rules are still a most welcome and useful tool within a Dynamics 365 developer’s arsenal.
Read more… Have you seen how Formula 1 has been using Dynamics 365?