PL 400: create and configure business rules(Implement processes)

Business rules play an important role in automation. It provides facility to non-developer to make minor changes at form or unit level. For these changes, the app maker does not need programming skills. The ability to create business rules that ensure consistent business logic regardless of the app accessing the data set is imperative to a successful business operation.


Business rules are server-side logic that is used with canvas or model-driven apps to set or clear values in one or many columns in a table.

Business rules encapsulate logic in a predefined set of steps that will run each time data is entered or modified and the data meets certain criteria to trigger business rules. Business rules give non-developers the ability to add logic to the field without adding JavaScript code.

Business rules are evaluated and any actions performed are in the following situations:
  • After the form is loaded 
  • After changing any value in the reference field within a condition in the rule

Business Rules have the following components :
  • Condition : This is a trigger and is used to determine whether a business is run based on values that have been added or edited in a table.
  • Action: An action is some logic.
  • Scope: Business Rules can have a scope.

Business Rules are server-side.

The business rule scope used by the canvas app is always set to the entity. Scope defines the condition in which a rule applies.

Actions can only be performed on fields, we cannot use actions with any other form component, such as sections or tabs.


The following actions are available in canvas apps:


Limitations when using business rules: 

  • Business rules run only when the form loads and when the value of the field referenced in the rule is changed. 
  • Rules do not run again when a record is saved unless the scope for the rule is set at an entity level. 
  • If a business rule references a field that is not present on a form, the rule will not be applied. 
  • There will be no error message to inform we that the rule hasn't been applied. 
  • When the scope is set to Entity, the rule will run twice – once on the form and once on the platform. 
  • Business rules work only with fields. If we need to manipulate other form elements, such as tabs or sections, we must use JavaScript. 
  • We can't have more than 10 if-else conditions in a rule. 
  • Nested if-else statements are not supported.
  • Grouping of expressions in a condition is not supported. 
  • Rules in conditions can be combined either using AND or using OR, but not both.
  • When We set a field value using a business rule, OnChange JavaScript event handlers for that field will not be triggered. However, business rules can meet a lot of requirements and we should balance the effort of creating rules against development.

The following are some guidelines on how to use business rules:
  • Use business rules only to manipulate a small number of fields.
  • Keep business rules simple by creating multiple rules, especially where there is a clear separation of terms and tasks.
  • Don't try to fit everything into one rule. Always take opposite actions through situations;
  • Don't mix and match JavaScript and business rules in the same form. Rename your forms with the information so that it is easier to set the scope.

Comments

Popular posts from this blog

Exploring the Differences: Managed vs. Unmanaged Solutions in Dynamics CRM/Dataverse

PCF vs. Web Resources: Choosing the Right Extensibility Tool for Dataverse

Effective Strategies for Debugging Plugins in Dynamics CRM