Skip to content

IF ELSE Functionality

The IF ELSE functionality is used to handle situations where actions depend on certain conditions being met. This allows for dynamic decision-making in your automation steps, so actions only run if specified conditions are met. In HuLoop, this is achieved through four actions:

  1. IF Action: Checks an initial condition and performs actions if it’s true.
  2. ELSEIF Action: Adds additional conditions to check if the original IF condition is not met.
  3. ELSE Action: Executes actions when none of the IF or ELSEIF conditions are met.
  4. ENDIF Action: Closes the IF ELSE block to indicate end of IF block.

If Statement: IF

The If Statement action checks if a condition is true and performs the designated actions if it is. This action starts the IF ELSE block and must be closed with ENDIF.

Note: When you add an IF block, an ENDIF block is automatically inserted into the workflow. You can collapse or expand these blocks using the or (expanded is the default view).

Example: Let’s say you want to compare two values and setting a variable based on the comparison result.

Suppose you have two predefined variables:

  • Value 1 = 200
  • Value 2 = 100

The automation should perform the following checks:

  1. If Value 1 is greater than Value 2 → Set another variable, Result = High
  2. Else → Set Result = Low (this part is explained in later section)

Steps to configure:

  1. Add a new step.
  2. Select IF from the Action drop-down.
  3. Leave the Screen Name blank.
  4. In Element Key, enter the value to be compared, e.g., Value 2.
  5. In Parameter, enter: STD_GREATERTHAN,${Value 1} (Value 1 is the reference value for comparison).
  6. Click Save.

v7_conditional_statement_if_else

Note: Ensure that the variables (Value 1 and Value 2) are already defined in the workflow before using them in conditions.

Outcome on Execution:

  • Since Value 1 (200) > Value 2 (100), the IF condition is met, and the automation sets Result = High.
  • If the condition is not met, the automation moves to the next part of the IF ELSE block, which will be covered in the Else statement section.

Refer to the screenshot below to see how an IF statement is visually represented in the workflow:

v7_conditional_statement_if_else_workflow
In the upcoming sections, we will configure ELSE and ELSEIF statements to handle additional conditions.

Else If Statement: ELSEIF

The Else If Statement action checks an additional condition if the IF condition wasn’t met. It allows you to handle multiple conditions sequentially before executing the final ELSE block.

Example: Checking an Alternative Condition

Building upon the previous example, suppose we now introduce an additional condition:

  • Value 1 = 200
  • Value 2 = 100
  • Value 3 = 150 (New variable for additional comparison)

The automation should perform the following checks:

  1. IF Value 2 is greater than Value 1 → Set Result = High (already explained).
  2. ELSEIF Value 2 is equal to Value 3 → Set Result = Equal (new condition).
  3. ELSESet Result = Low (to be covered in the next section).

Steps to configure:

After setting up the IF condition, add ELSEIF:

  1. After configuring the IF statement, add a new step.
  2. Select ELSEIF from the Action drop-down.
  3. Leave the Screen Name blank.
  4. In Element Key, enter the variable to be compared, e.g., Value 2.
  5. In Parameter, enter STD_EQUALS, ${Value 3} (Value 3 is the reference value for comparison).
  6. Click Save.

v7_conditional_statement_elseif

Note: Ensure that all variables (Value 1, Value 2, and Value 3) are predefined in the workflow before using them in conditions.

Outcome on Execution:

  • If the IF condition is met, ELSEIF is skipped, and the automation proceeds with the IF action.
  • If the IF condition is not met, the automation evaluates the ELSEIF condition:
    • If Value 2 (100) = Value 3 (150) → This is false, so ELSEIF is also skipped.
    • If the ELSEIF condition is met, the automation sets Result = Equal.
    • If neither IF nor ELSEIF conditions are met, the automation moves to the ELSE block (covered in the next section).

Refer to the screenshot below to see how an ELSEIF statement is visually represented in the workflow:

v7_conditional_statement_elseif_workflow

In the upcoming section, we will configure the ELSE statement to handle cases where neither IF nor ELSEIF conditions are met.

Else Statement: ELSE

The Else Statement command ensures that a defined step is executed when none of the previous conditions are met. It serves as the default fallback condition, ensuring that the workflow always has a defined next step.

It requires an ENDIF to close the block.

Example: Handling the Default Case

Continuing from the previous example, we now add an ELSE condition:

  • Value 1 = 200
  • Value 2 = 100
  • Value 3 = 150

The automation should perform the following checks:

  1. IF Value 2 is greater than Value 1 → Set Result = High (already explained).
  2. ELSEIF Value 2 is equal to Value 3 → Set Result = Equal (already explained).
  3. ELSEIf neither condition is met, Set Result = Low.

Steps to configure:

After setting up the IF and ELSEIF conditions, add ELSE:

  1. Add a new step.
  2. Select ELSE from the Action drop-down.
  3. Leave all other fields blank.
  4. Click Save.

v7_conditional_statement_else

Outcome on Execution:

  • If either the IF or ELSEIF condition is met, the ELSE block is skipped.
  • If both IF and ELSEIF conditions fail, the automation executes the ELSE block and sets Result = Low.

When checking multiple conditions, use multiple ELSEIF statements before the final ELSE to capture various scenarios.

Refer to the screenshot below to see how the ELSE statement is visually represented in the workflow:

v7_conditional_statement_else_workflow

In the upcoming section, we will configure the ENDIF statement to properly close the IF ELSE block.

Endif Statement: ENDIF

The Endif Statement action marks the end of the IF ELSE block, indicating that all conditions have been checked.

This statement is automatically added to the automation workflow to close the IF ELSE block.

Outcome on Execution:

  • Once any condition (IF, ELSEIF, or ELSE) is executed, the workflow reaches ENDIF, signaling the end of the conditional block.
  • The automation then proceeds to the next step outside the IF ELSE structure, if any.

Refer to the screenshot below to see how ENDIF is represented in the workflow:

v7_conditional_statement_endif_workflow

With this, the entire IF ELSE structure is complete, allowing the automation to handle multiple conditions effectively.

Full Example Recap:

  • IF: Check if Value 2 < Value 1; if true, set Result = High.
  • ELSEIF: If Value 2 does not meet Value 1, check if Value 2 = Value 3 and, if true, set Result = Equal.
  • ELSE: If neither condition is met, set Result = Low.
  • ENDIF: Closes the conditional block.

You can collapse or expand the IF ELSE block using the or sign in the workflow. This helps simplify the view when working with larger automation scripts.

The default view is expanded.

Last updated: Oct 12, 2025
Back To Top