Adding a branch to a Flow
  • 8 minutes to read
  • Print
  • Dark

Adding a branch to a Flow

  • Print
  • Dark

Branching can be added while creating a new Flow or when editing an existing one. The branched Flows are first created and then you create the main Flow. The following procedure explains how the main flow is created and then linked to the branch Flows.

  1. Click the Whatfix Editor plugin to launch the editor.

  2. Click Flow.

  3. Enter the name of the Flow as you want it displayed to a user.

  4. Click +Step.

  5. Select the element that encompasses all the options that you want to branch out from.
    branching drop down

  6. In the editor, scroll down to Step Completion Rules and select On click of selected element checkbox.

  7. Under the Branching Rules section, configure the branching conditions for the step.


If Branching Rules is not displayed, select the Advanced Options checkbox.

  1. Use the If condition to define the conditions for branching. The table at the end of this document explains each condition in detail.
  2. Use the Then condition to select and attach the flow you want to branch to. 
  3. Next, select the step number you want the flow to jump to.
  4. Use Add Another button to add multiple branching conditions, if needed.
  5. Finish creating the Flow.

Before Branching rules are evaluated,

  • The element of the step from where you branch out (step 5 above) must contain all the elements that you want to branch out from.
  • The step on which Branching is added (see step 5 above) must be completed before the Branching rule is evaluated. Ensure step completion rule is done.
  • The step completion rule selected (in step 6) where the encompassing selection is done must match with the action being done when evaluating the branching rules (step 8).
    Commonly used conditions when configuring branching rules are explained below.
    Condition Description
    Other Element

    If you want to identify a page based on the presence of a particular element (other than the one you have selected) on your web page, you can use this condition. The values passed to this condition are CSS selectors like #ID, .class or Jquery.

    Window Variable
    For advanced customization, you can choose to identify a page using the value of a particular Javascript global variable.
    Example: If you want to check user.role='admin', you can set the condition.
    You can also use this option to perform comparison options as below:
    • Greater than

    • Less than

    • Date Greater than

    • Date Less than

    Note: You don't need to add a window at the start for window variables.

    Action Element

    This is the element that the user clicks to decide which branch to take. These are typically buttons or tabs that do not have any options to choose from. Ensure that when selecting an action element, the step completion must be set to on selected element.

    Action Element Text This is the text that is displayed on the Action Element that is selected above.

    Selected Element Your application uses unique IDs for some elements on the page. This is used when your element is selected from a list of options. For example, a drop-down menu. This lets you provide your own CSS selector identifier for the element. Sample values

    Selected Element Text
    This is the text that is displayed on the Element selector that is selected above.
    If your application supports multiple languages, you can choose "is one of" option and add the name with a comma (,) as a delimiter.
    Note: The value is case sensitive.

    For a better understanding of CSS selectors, see CSS Selectors.

    • When you select the Action element or Other element on page as the condition, you do not need to find the code. Instead, use the Selector from the drop-down menu to simply click the element in your application and select the necessary value.

    • When you select Action Element as the condition, the Step Completion Rule must always be On click of selected element.
      step completion

    Supported Operators

    Operator Description
    Equals For exact match
    Not Equals Doesn't equal the value
    Contains Setvalue is present anywhere in the value of the condition. (Check for strings)
    Not Contains Setvalue is not present anywhere in the value of the condition
    Starts With Setvalue is at the beginning of the value of the condition
    Ends With Setvalue is at the end of the value of the condition
    Exists Setvalue is available (or true)
    Not Exists Setvalue is not available (or false)
  • Incomplete branches are not evaluated.
  • If you don't have the Flow that you want to skip to, you can add the conditions while creating the Flow and add the Flow later.
  • A step can have multiple branches. The first branch whose conditions are evaluated as true is selected.
  • If you have created Flows inside iframes then the window variable must be pointed to the respective frame. You may use window.frames
  • If you are adding multiple conditions, then the tip will show up only if all the conditions are true. (Similar to Boolean AND) 
  • jQuery CSS selector options will always show in the UI, however, it is supported ONLY for applications that have jQuery in the underlying platform
For window variables:
  • Greater and less than only accept numerical values
  • For date greater than/less than the default format is “MM/DD/YYYY”. The format can be changed to match your system date format. Contact Whatfix support to make this change.

Branching in an iframe and ShadowDOM application

When trying to select an element Whatfix automatically detects the best element from your application pages. However, there may be instances where certain elements cannot be detected. This could be because the selected element is located inside multiple layers of code iframe, ShadowDOM, or both.
The table below explains how branching can be done when you use iframe or shadowDOM applications. Note that the way you define element selection is different when you are dealing with an action element (when there is an action on the element) or if it is an other element (when there is no action on the element and you use the element to distinguish the page from other pages). An example for a selected element is a drop-down menu that could have several possible values. A selected element works just like an action element.

  • In an iframe application, if you are selecting an action element, then only the element and the immediate iframe that contains the element needs to be identified.
  • In an iframe application, if you are using the other element, the entire path is to be defined starting from the element back to the outermost iframe
  • In a ShadowDOM application, if you are selecting an action element or an 'other' element, the entire path is to be defined starting from the element back to the outermost ShadowDOM

See the example below for a clearer understanding of how to select an action element or an other element in each scenario.

When the element is in Action Element/ Selected Element Other Element


#element #element<<iframe2<<iframe1





ShadowDOM which is inside an iframe






Was this article helpful?