Skip to main content
Get Global Block Screenshot

Overview

The Get Global Block is used to retrieve a global value that is shared across all flows and subflows. The ID of the global value is configured in this block. The block can be configured to retrieve the value on demand, which means it will be read when blocks need it, rather than when this block executes. This is useful when the global value might change during the execution of the flow. The block can also be configured to wait until the variable is available. This is useful when the global value is set by another block that might not have completed its execution when this block runs.

Inputs

TitleData TypeDescriptionDefault ValueNotes
Variable IDstringThe ID of the global variable to retrieve. This input is only available if the “Use Input” toggle is checked.N/AThe input will be coerced into a string if it is not a string.

Example 1: Retrieve a global variable

  1. Add a Set Global Block to the flow. Set the variable name to myGlobalVariable and the value to Hello World using a Text Block.
  2. In a separate part of the flow, add a Delay Block and set the delay to 1000 (1 second).
  3. Create a Text Block and set the text to myGlobalVariable. Pass the text into the Delay Block.
  4. Create a Get Global Block, enable the input for “Variable Name”, and pass the output of the Delay Block into the input. Disable the “On Demand” setting.
Get Global Block Example 1

Example 2: Retrieve a global variable on-demand

  1. Add a Set Global Block to the flow. Set the variable name to myGlobalVariable and the value to Hello World using a Text Block.
  2. Add a Get Global Block and set the variable name to myGlobalVariable. Enable the “On Demand” setting.
  3. Add an If Block. Set the If input to the Set Global Block, and set the Value input to the Get Global Block. This will wait for both blocks to complete before running, and will pass the Get Global Block’s value through to the next block.
  4. Add a Text Block and connect the If Block to the Text Block.
  5. Run the flow. Notice that the value of the If block is Function<string> because the “On-Demand” setting has been enabled, causing the value to not have resolved yet. The value is resolved in the Text Block, and “Hello World” is displayed.
Get Global Block Example 2

Error Handling

The Get Global Block will error if the global variable is not found and the Wait setting is disabled. If the Wait setting is enabled, the block will wait until the variable is available.

FAQ

Q: What is a global variable? A: A global variable is a value that is shared across all flows and subflows. It is set using a Set Global Block and retrieved using a Get Global Block. Q: Can I set a global variable from a parent application? A: No, global variables can only be set from within the flow. Use a Context Block instead to access global variables set by the parent application. Q: What happens if the global variable is not found? A: If the global variable is not found and the Wait setting is disabled, the Get Global Block will return the default value for the data type selected. For example, if the data type is set to string, the default value will be an empty string. If the Wait setting is enabled, the block will wait until the variable is available before returning the value.

See Also