Configuring Form Rule Using Formula
Table of Contents
Use Case
In the CMW Platform, you can define a set of rules for any form to control its element behavior.
Each rule can include several conditional actions:
- Set field values
- Show field validation warnings and error messages
- Change element access mode: require entry, allow entry, read-only
- Hide elements
In this article, we will create a form rule to hide the Recipient field from the form when this field is empty and the Enter new customer details box is checked.
Prerequisites
To proceed with the example, create the templates and attributes as shown in the table below:
Record template system name | Attribute and field display name (system name) | Attribute type | Description |
---|---|---|---|
Request | Recipient (recipient) | Record |
Place this attribute on the form as the Recipient field. |
Enter new customer details (create_flag) | Boolean |
Place this attribute on the form as the Enter new customer details checkbox. |
Instructions
- In the Request template, open the default form.
- Open the Form rules designer using the dropdown next to the form heading.
- Add a rule and an action to the rule.
- Select the action to display the Action properties pane.
- From the Form element dropdown, select the Recipient field.
- From the Action dropdown, select Change access.
- From the New value dropdown, select Hide.
- In the Execution condition field, enter the formula:
AND(EMPTY($recipient),$create_flag == true)
- Click Save.
Formula Syntax
Element | Description |
---|---|
AND() |
This function takes two arguments and returns |
$ |
This prefix refers to an attribute in the current record context. |
|
This function returns true if its argument has an empty value, i.e., when the Recipient attribute value is null. |