Why business rules?
Business rules provide an easy declarative way to consistently evaluate the business logic on both client and server, without the need to write code. The client-side logic evaluation is more immediate because it is performed when you open and update the record form, while the server-side provides consistent logic evaluation on the server.
- The business rule is executed only on the client, if the rule’s scope is set at a form level (all forms or a specific form). The rules are executed when a record form is loaded and updated.
- The business rule is executed both on the server and client, if the rule’s scope is set at an entity level. The rules on the server-side are executed when a record is created or saved.
What can business rules do?
Business rules allow for a subset of the capabilities provided by form scripts. You can define conditions and apply the following actions:
- Set field values
- Clear field values
- Set field requirement levels
- Show or hide fields
- Enable or disable fields
- Validate data and show error messages
Business rules can be set to apply to all Main or Quick Create entity forms or specific Main forms that you choose. You can also set the rule to apply to an entity.
You can transport business rules from one organization to another by including them in a solution and you can install solutions that contain business rules.
Examples of how to set or clear field values
Let’s consider a couple of examples. With the first rule, for any immediate purchase, you apply a 5% discount. With the second rule, you clear all discounts if the purchase timeframe is unknown,
The following rule definition shows how to set a field value to a 5% discount for immediate purchases.

The following rule definition shows how to clear a field value – clear all discounts, for purchases with an unknown purchase timeframe.


How do I configure business rules?
First, you need to have the privileges necessary to navigate to Settings > Customization. This typically requires the System Administrator or System Customizer security role. To activate a business rule, you must have the Activate Business Rules privilege.
Note |
|---|
| Business rules will only work for Updated Entities or custom entities. |
There are four ways you can view, create, or edit business rules:
- Solution > Entity
- From a solution, such as the default solution, you will find a Business Rules node for all entities.

- Solution > Entity > Field
- When you view an entity field, you will find a Business Rules node that will show you only the business rules that include this attribute.

- Form Editor
- From the form editor, you can use the Business Rules button in the ribbon to show the Business Rules Explorer on the right side. This will show you all business rules that will be applied just for this form.If you create a rule from the form editor, the default scope is for that form. More information: Set the scope

- Form Editor > Field
- When you view the properties for a field that is used in a form, you will see a Business Rules tab that shows you the business rules that include this attribute.

If an existing rule is similar to a rule you want to make, you can open that rule and use the Save As button to copy an existing rule as a starting point for a new rule.
Note
No comments:
Post a Comment