Skip to main content
Liaison

Using Conditional Logic for Follow-Up Questions

If you're working with the Applicant Portal in Outcomes, you can create Applicant Forms for applicants to complete. In this article, you'll learn how to add conditional questions to your forms. You can apply the same code to questions you include in Inquiry Forms, Evaluation Forms, and other areas.

Conditional questions only appear when the conditions you set have been met. For example, if you have a "Have you previously applied to our program?" question, you may add a conditional follow-up question that asks "What year did you apply?". You can set this question to only appear if the answer to the "Have you previously applied to our program?" question is "Yes".

Adding Conditional Questions

Once you have created an Applicant Form, you can begin adding questions. To add a conditional question:

  1. Add your starting question, or confirm it exists. The response to the starting question is what the software will use to determine whether the conditional question appears. In the example cited above, "Have you previously applied to our program?" is the starting question. This starting question should have a Question Type of Multiple Choice or Drop Down.
  2. Add your conditional question. The conditional question is the one that will only appear when the conditions you set are met. In the example cited above, "What year did you apply?" is the conditional question.
  3. In the Condition field, add the appropriate expression.

    Example of conditional question

Example Conditions

Below are examples of JavaScript expressions that work to show a conditional question. You can modify these to suit your needs.

Starting question equals a specific response
intendedMajor == 'Business Administration-BBA'

When placed as a condition for a new question, the code above causes the software to show the new question only when an applicant has selected "Business Administration-BBA" as the answer to "What are you interested in studying?" (field key: intendedMajor ).

Starting question does not equal a specific response
us_residency !== "U.S. Citizen"

When placed as a condition for a new question, the code above causes the software to show the new question only if the response to the US Residency question (field key: us_residency) is not "U.S. Citizen". 

Starting question equals one response OR another response
citizenship == 'Non-U.S. Citizen'||citizenship == 'U.S. Permanent Resident'

When placed as a condition for a new question, the code above causes the software to show the new question only if the response to the citizenship question (field key: citizenship) is "Non-U.S. Citizen" or "U.S. Permanent Resident".

Starting question equals one response AND another response
race == 'Asian' && race == 'Native Hawaiian or Other Pacific Islander'

When placed as a condition for a new question, the code above causes the software to show the new question only if the response to the race question (field key: race) is "Asian" and "Native Hawaiian or Other Pacific Islander".

Comparison Operators

When creating conditional questions, you can use any acceptable comparison operator. See the chart below for a list of comparison operators.

Name

Operator

Example

equal == (double equal sign) intendedMajor == 'Business Administration-BBA'
not equal != intendedMajor != 'Business Administration-BBA'
greater than > yearApplied > 2015
less than < yearApplied < 2023
greater than or equal >= yearApplied >= 2015
less than or equal <= year applied <= 2023
strict equal (true if operands are equal and of same type) === (triple equal sign) previouslyApplied === 'Yes'
strict not equal (true of operands are not equal or of different type) !== previouoslyApplied !== 'Yes'
Logical Operators

When creating conditional questions, you can use logical operators (e.g., and, or) that involve more than one question, as long as both questions are on the same form. For example, this is an acceptable condition:

forms.race_ethnicity.hispanic == 'Yes' && forms.race_ethnicity.hispanic_sub == 'Puerto Rican'

See the chart below for a list of logical operators.

Name

Operator

Example

and && race == 'Asian' && race == 'Native Hawaiian or Other Pacific Islander'
or || birth_location.country.includes("United States") || birth_location.country.includes("US")
not ! has_preferred_name != null
Finding the Keys to Use

To make this code work in your environment, you'll need to replace the keys in the example above with the appropriate keys from your forms. To find these keys:

  1. Look for the "key" indicator near the starting question.

    locating-all-eval-form-keys.png
  2. Alternatively, you can search the Field Dictionary to find the question you're looking for.
  • Was this article helpful?