Conditions
Form conditions are rules that are checked before the page, tab, question, or option is displayed. If the condition is not met, the element is not shown. Conditions can be used, for example, to make a page or a question conditional upon the answer given to a previous question.
For example, for the question "Do you have any dependents?" you can create a page that allows users to enter further details if they select "Yes". Those answering "No" will not see the page.
The condition field is available as an advanced option for:
-
Pages: display the page or tab only if the condition is met.
-
Questions: display the question only if the condition is met.
-
Options: display the option only if the condition is met.
-
Buttons: display the button only if the condition is met.
-
Data links: only write the value to the linked object if the condition is met.
The examples that follow detail common ways to use conditions for your pages, questions, and data links.
For information about the operators and functions supported for formulas, see Supported operators and functions.
Conditions: examples
Page conditions
Page conditions are used to check the answer to a question on a previous page and decide whether or not to show the conditional page. For example, if the Employee Information page has the question "Do you have any dependents?", you can display the Dependent Information question page only if the answer to the question is "yes".
The question on which the condition depends is as follows:
The details of the "Do you have any dependents?" question are:
-
A radio type question
-
Question name: "HaveDep"
-
Options: "Yes" and "No".
We want to make the Dependent Information page or tab conditional on the answer to the question. On the Dependent Information page, the Show Page Conditions field is set to: HaveDep="Yes".
This condition sets the page to be displayed only for users who selected "Yes" to the HaveDep question. Those who selected "No" will not see the Dependent Information page and will skip to the next page in the form.
See the HCM onboarding form worked example topic Create a new form page and questions for another example of using conditional pages.
Question conditions
Question conditions are used to make a question dependent on the answer given to a previous question. For example, if you have previously asked the user's marital status, you can display a question requesting spouse details.
Conditional questions should be on a later page in the form than the question that the condition checks. (Because form pages do not refresh automatically, if you add a conditional question to the same page as the question that the condition is looking for, the conditional question will not be displayed until you refresh the page or navigate back to it.)
You can build conditions that rely on the answers to more than one question.
In this example, the conditional question is "What is your maiden name?" This question is only shown based on the answers to 2 earlier questions:
-
"What is your gender?" (EmpGender) = Female
-
"What is your marital status?" (EmpMaritalStatus) = Married
The "What is your maiden name?" question has the following condition:
EmpGender="Female" && EmpMaritalStatus="Married"
Where && is an operator that means AND: both conditions must be true for the condition to be met. In this example, the "What is your maiden name?" question is only shown if both conditions are true.
See Supported operators and functions for more information about how to create complex conditions.
Data link conditions
Data link conditions are used to write data back to your form's linked objects only if the condition is met. For example, you can set a condition on a data link rule that will check the value of a question field, so that the rule is only triggered if the value entered for that question meets the condition.
NOT (ISBLANK) condition for empty fields
Without conditions, data link rules will create blank records for fields that have been left blank. It's good practice to add conditions for non-mandatory fields that have an associated data link rule, to ensure that the rule does not create empty records.
In the following example, the form has a text entry field for Passport Number (PassportNo). This field is associated with a data link rule that writes the passport number back to a field in the Passports object, related to the Team Member record. The condition NOT (ISBLANK(PassportNo))
ensures that if the passport number field is left blank, the condition will not be met and the data link rule will not be triggered.