Configuring Button Display Condition with Formula
Table of Contents
Use Case
You can show or hide a button depending on the application context. For this, define the button Display condition using a formula or an N3 expression.
In this article, we will create and configure the Add new item button to be visible only when the Request Status is New or AddedToCart.
Prerequisites
To proceed with the example, create the templates and attributes as shown in the table below:
Record template system name | Attribute system name | Attribute type | Description |
Request | Status | Record | The Status attribute is linked to the Request_status template. |
Request_status | Status_code | Text |
The Request_status template contains records with the following Status_code values:
|
Instructions
- In the Request record template, go to the Buttons tab.
- Create the Add new item button.
- On the Display condition tab enter the formula:
OR($Status->Status_code == "New",$Status->Status_code == "AddedToCart")
- Click Save to save the button.
- Place the Add new item button on the default form toolbar in the Request record template.
- Test the resulting button:
- Create a Request with the New or AddedToCart status: the Add new item button should be visible.
- Create a Request with the Pending status: the Add new item button should not appear.
Formula Syntax
Element | Description |
---|---|
OR() |
This function takes two arguments and returns true if any of the arguments is true . In our case, we evaluate if the Status_code attribute value equals New or AddedToCart. |
$ |
This prefix refers to an attribute in the current record context. |
-> |
This operator refers to an attribute of the linked Request_status template. |