Overview
Form Rules control whether a Form, or an individual Template within a Form, is visible to users when viewing a Record.
A Rule uses an OData Filter to define when content should be hidden. It can apply to:
- The entire Form
- A selected Template within the Form
- All users
- Members of selected Teams
For example, an Audit App might:
- Hide its Results Form until the Audit is complete.
- Hide a Corrective Action Template unless a question has failed.
- Hide Templates containing management information from members of the Auditors Team.
Form Rules control visibility only. They do not provide security, change permissions or remove the underlying Field values.
Contents
- How Form Rules Work
- Accessing Form Rules
- Configuring a Form Rule
- Example: Hide an Entire Form
- Example: Hide a Template
- Restricting Visibility by Team
- Using Multiple Rules
- When Rules Are Applied
- Important Considerations
- Related Articles
How Form Rules Work
A Form Rule contains three main settings:
- Filter Rule: An OData Filter that defines when the Rule applies.
- Hidden For Teams: The Teams whose members should have the Form or Template hidden.
- Target Template: The Template that should be hidden when the Rule applies.
When the Filter Rule is met, the selected content is hidden.
If Target Template is left blank, the entire Form is hidden.
If Hidden For Teams is left blank, the Rule applies to all users. If one or more Teams are selected, it applies only to users who are members of at least one of those Teams.
Accessing Form Rules
To access the Form Rules for a Form:
- Open the App in App Studio.
- Under Input & Layout, select Forms.
- Select the Form you want to configure.
- Expand Form Rules.
- Select Add Rule.
Configuring a Form Rule
When adding or editing a Rule, configure the following properties.
1. Filter Rule
Enter the condition as an OData Filter. The Rule applies when this condition is met.
The Filter must begin with:
$filter=
Field Identifiers are enclosed in square brackets. Operators such as eq and ne are used to compare the Field value with the required value.
For example:
$filter=[AuditCompletion] ne 100
This condition is met whenever Audit Completion does not equal 100.
Text values are enclosed in single quotation marks:
$filter=[AuditScore] ne 'Fail'
Multiple conditions can be combined using operators such as and or or.
For example:
$filter=[AuditScore] ne 'Fail' and [AuditScore] ne 'Critical Fail'
This condition is met when Audit Score is neither Fail nor Critical Fail.
For more Filter operators, data types and examples, see Filters (OData) – Simple and Filters (OData) – Advanced.
2. Hidden For Teams
Use Hidden For Teams when the Form or Template should be hidden only from members of particular Teams.
- Leave it blank to apply the Rule to all users.
- Select one or more Teams to apply the Rule to members of any of those Teams.
The Filter Rule must still be met before the Team restriction is applied.
3. Target Template
Use Target Template when the Rule should hide only one Template within the Form.
- Leave it blank to hide the entire Form.
- Select a Template to hide only that Template.
A Target Template must already be included in the Form.
Example: Hide an Entire Form
Consider a Compliance Audit App containing two Forms:
- Audit: Used to complete the Audit.
- Results: Displays the Audit results and charts.
The Results Form should remain hidden until the Audit is complete.
To configure this:
- Open the Results Form in App Studio.
- Expand Form Rules.
- Select Add Rule.
-
Enter:
$filter=[AuditCompletion] ne 100 - Leave Hidden For Teams blank so that the Rule applies to all users.
- Leave Target Template blank so that the Rule applies to the entire Results Form.
- Select OK.
- Select Save on the Form.
- Publish the App when the changes are ready.
While Audit Completion does not equal 100, the Results Form is hidden.
When Audit Completion reaches 100, the Filter Rule is no longer met and the Results Form becomes visible.
Example: Hide a Template
A Rule can also hide one Template without hiding the whole Form.
For example, an Audit Question might require a Corrective Action only when its Audit Score is:
- Fail
- Critical Fail
At all other times, the Corrective Action Template should be hidden.
Use the following Filter Rule:
$filter=[AuditScore] ne 'Fail' and [AuditScore] ne 'Critical Fail'
Select Corrective Action as the Target Template.
The condition is met when Audit Score is neither Fail nor Critical Fail, so the Corrective Action Template is hidden.
If the Audit Score changes to Fail or Critical Fail, the condition is no longer met and the Template becomes visible.
Restricting Visibility by Team
A Form Rule can hide content only from members of selected Teams.
For example, the Corrective Action Template may need to be visible to Audit Managers when a question fails, but remain hidden from Auditors regardless of the Audit Score.
To achieve this, use two Rules.
Rule 1: Hide the Template When a Corrective Action Is Not Required
Configure:
-
Filter Rule:
$filter=[AuditScore] ne 'Fail' and [AuditScore] ne 'Critical Fail' - Hidden For Teams: Leave blank
- Target Template: Corrective Action
This hides the Template from everyone unless the Audit Score is Fail or Critical Fail.
Rule 2: Always Hide the Template from Auditors
Configure:
-
Filter Rule:
$filter=true eq true - Hidden For Teams: Auditors
- Target Template: Corrective Action
Because true eq true is always met, members of the Auditors Team cannot see the Template regardless of the Audit Score.
The combined result is:
| User | Audit Score | Corrective Action Template |
|---|---|---|
| Audit Manager | Fail or Critical Fail | Visible |
| Audit Manager | Any other result | Hidden |
| Auditor | Any result | Hidden |
Using Multiple Rules
Each Form Rule is evaluated independently.
If any Rule that applies to the current user is met, its target Form or Template is hidden. This means multiple Rules effectively provide several separate reasons why the same content may be hidden.
For example, a Template might be hidden because:
- The Record is at the wrong stage.
- A particular response has not been selected.
- The user belongs to a Team that should not see it.
When combining Rules, consider the main expected outcomes for different users and Record states. A simple table or a few representative checks can help confirm the configuration before publishing the App.
When Rules Are Applied
Visibility normally updates immediately or nearly immediately when a value used by the Filter Rule changes.
The timing depends on how the value is populated:
- Manual input: The Rule should apply immediately as the user changes the value.
- Expression: The Rule should apply almost immediately after the calculated value updates.
- Workflow: The Rule may apply shortly after the Workflow updates the Field.
- Slow connection: There may be a short delay while the latest calculated value is returned by the server.
- Offline use: Rules that depend on values populated by an Expression or Workflow may not apply until the connection is restored and the latest values are received.
Where a Rule must operate while users are offline, base its Filter Rule on manually entered values rather than values that rely on an Expression or Workflow.
Important Considerations
Form Rules Control Visibility, Not Security
A Form Rule hides content from the Workspace interface. It does not provide a security boundary or change the user’s permissions.
Do not use Form Rules as the only method of protecting sensitive information. Use the appropriate Record Access Rights where access to the Record or its data needs to be controlled.
Hidden Values Are Retained
Hiding a Form or Template does not:
- Delete or clear existing Field values.
- Prevent Expressions from using those values.
- Prevent Workflows from reading or updating those values.
- Remove the values from the underlying Record.
If a Form or Template later becomes visible again, its existing values remain available.
Be Careful with Required Fields
A hidden required Field can still prevent a Record from being created or updated if it does not contain a value.
Because the Field is hidden, the user may be unable to enter the missing value and resolve the validation error.
When applying a Form Rule to a Template containing required Fields, make sure that:
- Each required Field already has a value;
- another process reliably populates the value; or
- the Field does not need to be Required while the Template is hidden.
Check both new and existing Records before publishing the Rule. For more information about Required Fields and other Field behaviour, see Field Parameters.
Write the Filter for the Hidden State
The Filter Rule defines when the content is hidden, not when it is shown.
For example, if the Results Form should be visible when Audit Completion equals 100, the Rule must identify the opposite condition:
$filter=[AuditCompletion] ne 100
Thinking in terms of “When should this be hidden?” helps avoid reversing the intended behaviour.
Test Representative Outcomes
Before publishing, check the main scenarios relevant to the Rule:
- When the Filter Rule is met.
- When the Filter Rule is not met.
- Users within selected Teams and users outside those Teams.
- New Records with blank values, where blank values affect the Rule.
- Existing Records containing values.
- Required Fields within hidden Templates, where applicable.
- Offline use, where the App is expected to support it.
- Values populated manually, by Expression or by Workflow, where those methods are used.
Focus on the outcomes that are most important to the App’s intended behaviour and any scenarios that could prevent users from completing or updating a Record.
Save and Publish the Changes
Selecting OK adds the Rule to the Form configuration, but the Form must still be saved.
After adding or editing a Rule:
- Select OK.
- Select Save on the Form.
- Publish the App when the changes are ready to become available in the Workspace.
Comments
0 comments
Please sign in to leave a comment.