Set up business rules
Business rules control the page UI behavior and business logic. You can specify conditions and actions to take when those conditions are met. This lets you customize page behavior to better suit your needs, streamline data entry, enforce data standards, and improve data quality.
To access business rule configuration on an app page:
-
Click in the top right → Application Hub.
-
Open the needed app or create a custom app.
-
Open the page or create a custom page.
-
Click the button in the top right (Fig. 1).
View the list of business rules
You can set up business rules on the page or object level. After you set up a page-level rule, Creatio applies it to the elements only on the selected page. After you set up an object-level rule, Creatio applies it to every Freedom UI page that uses the corresponding object, including editable lists. You can set up multiple business rules for a page or object. The list of business rules is displayed on the business rules setup page (Fig. 2).
If multiple rules affect the same page element, only the first rule is activated.
-
Click Add rule to create a new business rule.
-
Select a rule in the list and click its name to view or edit the rule.
-
Select a rule in the list and click the Enabled toggle in the setup area to turn the rule on or off (Fig. 3).
-
Select a rule in the list and click → Copy to copy the rule.
-
Select a rule in the list and click → Delete to delete the rule.
Show/hide an element on a Freedom UI page
You can set up a business rule that makes certain elements on record pages visible or hidden under specific conditions.
Show the Sick leave, days left field on a request page for requests whose Originator type attribute is an employee.
To implement this, the Sick leave, days left field must be visible only if the value of the Originator type field is "Employee." To do this:
-
Open the needed section (for example, the "Requests" custom app) and add a business rule.
-
Set the filter to define the conditions that trigger the business rule in the IF block. For this example, apply the rule to requests that have the "Employee" originator type:
- Click Add condition. This adds a condition row.
- Select the "Originator Type" attribute in the new row.
- Leave the "=" (equal) sign as it is.
- Click the icon and select the "Lookup" field type in the drop-down list. This adds a lookup value field to the right.
- Select the "Employee" lookup value.
-
Set up the action that implements the needed business logic in the THEN block. For this example, show the Sick leave, days left field:
- Click Add action → "Show elements."
- Select the element type to show in the Which element will be shown? block. For this example, select Input. This opens a window.
- Select the field to show on the page, e. g., Sick leave, days left, and click Select.
-
Save the changes.
As a result, Creatio will show the Sick leave, days left field only for requests whose Originator type field is set to "Employee." If the Originator type field is set to any other value, Creatio will hide the Sick leave, days left field.
Make a field required or optional
You can set up a business rule that makes elements required under specific conditions.
Make the Start date and Due date fields on a request page required for requests whose Type attribute is "Vacation."
To do this:
-
Open the needed section (for example, the "Requests" custom app) and add a business rule.
-
Set the filter to define the conditions that trigger the business rule in the IF block. For this example, apply the rule to requests that have the "Vacation" type:
- Click Add condition. This adds a condition row.
- Select the "Type" attribute in the new row.
- Leave the "=" (equal) sign as it is.
- Click the icon and select the "Lookup" field type in the drop-down list. This adds a lookup value field to the right.
- Select the "Vacation" lookup value.
-
Set up the action that implements the needed business logic in the THEN block. For this example, make the Start date and Due date fields required:
- Click Add action → "Make elements required."
- Select the element type to make required in the Which element will be required? block. This opens a window.
- Select the fields to make required on the page, e. g., Start date and Due date, and click Select.
-
Save the changes.
As a result, Creatio will make the Start date and Due date fields required for requests whose Type field is set to "Vacation." If the Type field is set to any other value, the fields mentioned will be optional.
Enable or disable an element
You can set up a business rule that enables or disables any page component under specific conditions. For fields, this means making them editable or read-only.
Make the Owner field on a request page read-only for requests whose Status attribute is "Done" or "Canceled."
To do this:
-
Open the needed section (for example, the "Requests" custom app) and add a business rule.
-
Set the filter to define the conditions that trigger the business rule in the IF block. For this example, apply the rule to requests that have the "Done" or "Canceled" status:
- Click Add condition. This adds a condition row.
- Select the "Status" attribute in the new row.
- Leave the "=" (equal) sign as it is.
- Click the icon and select the "Lookup" field type in the drop-down list. This adds a lookup value field to the right.
- Select the "Done" lookup value.
- Click Add condition. This adds a condition row.
- Select the "Status" attribute in the new row.
- Leave the "=" (equal) sign as it is.
- Click the icon and select the "Lookup" field type in the drop-down list. This adds a lookup value field to the right.
- Select the "Canceled" lookup value.
-
Set up the action that implements the needed business logic in the THEN block. For this example, make the Owner field read-only:
- Click Add action → "Make elements read-only."
- Select the element type to make required in the Which element will be read-only? block. This opens a window.
- Select the fields to make required on the page, for example, Owner, and click Select.
-
Save the changes.
As a result, Creatio will make the Owner field read-only for requests whose Status field is set to "Done" or "Canceled." If the Status field is set to any other value, the field will be editable.
Apply a static filter
You can set up a business rule that will apply filter to the list of values in the lookup field. This will make the list shorter.
Show only employees in the Contact lookup field for internal requests.
To do this:
-
Open the needed section (for example, the "Requests" custom app) and add a business rule.
-
Set the filter to define the conditions that trigger the business rule in the IF block. For this example, apply the rule to internal requests:
- Click Add condition. This adds a condition row.
- Select Attribute in the IF block → "Request category."
- Leave the "=" (equal) sign as it is.
- Select Lookup → "Internal requests."
-
Set up the action that implements the needed business logic in the THEN block. For this example, filter the Contact field to only have employees:
- Click Add action → Apply static filter.
- Select the lookup field for the static filter in the Filter field. For example, select "Contact."
- Click Setup filter to configure the static filter. A modal will open.
- Click Add condition to add a new static filter condition. A dialog box will open.
- Select the name of the field whose value will be used in the current static filter condition in the Column lookup. For example, select "Type" and click Select. This will close the dialog box and add a static filter condition.
- Click the icon to update the static filter condition. This will open a modal with the lookup values for the Type field of the Contact entity.
- Select all eligible checkboxes (for example, "Employee") and click Select. This will close the dialog box.
-
Save the changes.
As a result, when the "Internal requests" lookup value is selected in the Request category field, only contacts of the Employee type will be available in the Contact field on the requests form page.
Filter lookup values based on another lookup
You can make lookup fields in forms more user-friendly and efficient by setting up filtering rules based on another lookup. When one lookup field depends on the value of another, you can configure Creatio to show only the relevant choices in the dependent field based on what was selected in the first field. You can also set the dependent field to automatically clear its current value if the filtering field changes, and autopopulate with a new value if available. These behaviors are enabled by default in Freedom UI's custom business rules, making forms more intuitive and reducing manual data entry.
Filter cities by the country selected in the Country lookup field for requests that must be related to a given location.
To filter lookup values based on another lookup:
-
Open the needed section (for example, the "Requests" custom app) and add a business rule.
-
Set the filter to define the conditions that trigger the business rule in the IF block. For this example, apply the rule to requests that have the Country field filled in:
- Click Add condition. This adds a condition row.
- Click Add rule in the Requests business rules block in the left pane.
- Select Attribute → "Country" → "Is filled in."
- Select "Is filled in."
-
Set up the action that implements the needed business logic in the THEN block. For this example, filter the City field to only have cities that are located in the current country:
- Click Add action → Apply filter.
- Select the lookup field to filter in the Filter field. For this example, it is the "City" field.
- Select the lookup field whose value will be used to filter the other field in the By field. For this example, select "Country."
- Business rules have automatic clearing and population of lookup values enabled by default. To disable automatic clearing, clear the Clear value... checkbox. To disable automatic population, clear the Populate value... checkbox.
-
Save the changes.
As a result, when a Country field on the request page is filled in, the lookup options for the City field will be filtered based on the selected country.