--- title: "Troubleshooting Data Workflow Errors: Comprehensive Guide" slug: "how-to-reference-a-global-variable-in-a-component" description: "Learn how to troubleshoot data workflow errors effectively. Discover tips for using components like Checkpoint and Timer Start for optimal results." updated: 2026-01-20T18:18:57Z published: 2026-01-20T20:38:53Z canonical: "docs.unqork.io/how-to-reference-a-global-variable-in-a-component" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.unqork.io/llms.txt > Use this file to discover all available pages before exploring further. # How to: Reference a Global Variable in a Component Let's explore how to reference a in a component. A **global variable** is an identifier (or key) paired with a stored value. Once paired, you can reference the key anywhere in your application. This separation of the key from its value lets you use your key independent of the data it represents. Global variables let you avoid hardcoding reference values in your application's environment levels. They also help you avoid issues during your application's [promotion](https://docs.unqork.io/docs/promoting-applications) process. [Global Variables Administration](https://docs.unqork.io/docs/global-variables-administration) lets you standardize the way you create and reference custom variables. It's important to note that the global variable you create is only available in the environment level where you created it, like Staging for UAT. To have your global variable resolve in another environment level, you must promote it. Or, create it manually in that environment level. That way, your values can be resolved dynamically based on the environment level your application is running in. You can reference variables in all components that reference submission data objects, including a data source URL, and [Calculator](https://docs.unqork.io/docs/calculator-component) and [Decisions](https://docs.unqork.io/docs/how-to-guide-decisions-component) components. To reference a global variable, a key and the prefix `vars` are required. So, the formatting looks like the following: `vars.Key`. Alternatively, you can use a `vars` [getter](https://docs.unqork.io/docs/getters) in combination with a formula. > [!CAUTION] > Don't use Global Variables Administration to store sensitive data, like APIs and secrets. Global variable values display to users while building applications in Unqork. > [!TIP] > To learn more about promoting global variables, visit our [Global Variables Administration: Global Variables Promotion](https://docs.unqork.io/docs/global-variables-administration-global-variable-promotion) article. Select the tab that corresponds to your Unqork Designer experience: **UDesigner** ## Preconfiguration In this how-to guide, you'll create a variable to reference your current environment level using [Global Variables Administration](/v1/docs/global-variables-administration). Then, you’ll reference it using a [Calculator](/v1/docs/calculator-component) component. ### Add a Global Variable Begin by adding a global variable for your current environment level. This how-to guide focuses on creating a global variable for your Staging environment. 1. At the top right of the Unqork Designer Platform, click **Administration**. 2. Under Environment, select **Global Variables**. 3. At the bottom of the Global Variables page, click **New Global Variable**. 4. In the **Enter** **Key** field, enter `envUrl`. 5. In the **Enter Description** field, enter `Staging URL`. 6. Clear the **Server-Side Only** checkbox. > You must be an Administrator to create global variables, but you can still view the environment level’s variables in the DevTools Console, as long as **Server-Side Only** is deselected. 7. In the **Enter** **Value** field, enter your Staging environment's URL. The formatting is: `{your-environment}-staging.unqork.io`. ![Global Variables section showing key, description, and value for staging URL.](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/UD_Add_GlobalVariable(1).jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) 8. In the **Actions** column, click **Save**. ## Configuration > [!NOTE] > These instructions assume you have a module open, saved, and with a title. ### Configure the Initializer Component Now that you have your global variable, configure a module to reference it. 1. In the Module Builder, drag and drop an **Initializer** component onto your canvas. 2. In the **Property ID** and **Canvas Label Text** fields, enter `initOnLoad`. 3. From the **Trigger Type** drop-down, select **New Submission**. 4. In the **Outputs** table, enter the following: | | Source | Type | Value | | --- | --- | --- | --- | | 1 | calcEnvUrl | trigger | GO | > [!NOTE] > This Property ID corresponds to the Calculator component you'll set up next. ![A static image displaying the Initializer configuration for a component with trigger type and output values displayed.](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/UD_GV_INIT.jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) 5. Click **Save Component.** ### Configure the Calculator Component Next, configure a [Calculator](/v1/docs/calculator-component) component to reference the global variable. To reference your global variable, you must input it as `vars.Key`. In this example, the input is `vars.envUrl`. Then, output the value to a [Hidden](/v1/docs/hidden-component) component you’ll configure next. 1. Drag and drop a **Calculator** component onto your canvas, placing it below your `initOnLoad` **Initializer** component. 2. In the **Property ID** and **Canvas Label Text** fields, enter `calcEnvUrl`. 3. In the **Inputs** table, enter the following: | # | Source | Alias | Required | | --- | --- | --- | --- | | 1 | vars.envUrl | E | ![](https://files.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Checked_Box(11).png) (checked) | 4. In the **Outputs** table, enter the following: | # | Source | Formula | | --- | --- | --- | | 1 | envUrl | =E | ![A static image displaying the Calculator interface showing inputs and outputs for environment URL configuration.](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/UD_GV_CALC.jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) 5. Click **Save Component**. > [!TIP] > Alternatively, you can input `vars` as the Property ID and use the output formula: `=GET(E, 'envUrl')`. This formatting works for any global variable key: `=GET(E,'Key')`. You can also use global variables directly in a [Calculator](https://docs.unqork.io/docs/calculator-component) and [Plug-In](https://docs.unqork.io/docs/plug-in-component) component using the following syntax: `vars.globalVarName`. ### Configure the Hidden Component Lastly, configure a [Hidden](https://docs.unqork.io/docs/hidden-component) component to store the value of your global variable. 1. Drag and drop a **Hidden** component onto your canvas, placing it below your `calcEnvUrl` **Calculator** component. 2. In the **Property ID** and **Canvas Label Text** fields, enter `envUrl`. 3. Set **Store Data in Database** to ![A toggle switch indicating an on/off state for a user interface element.](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Group 1.png?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) **(ON)**. 4. Click **Save Component**. 5. **Save** your module. Here’s how your completed module looks in the [Module Builder](https://docs.unqork.io/docs/introduction-to-the-module-builder): ![A static image displaying the module builder configuration showing functions initOnLoad, calcEnvUrl, and envUrl in a UI interface.](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/UD_GV_modulebuilder.jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) You must be an Administrator to create global variables, but you can still view the environment level’s variables in the DevTools Console, as long as **Server-Side Only** is deselected. Here’s how your global variable looks in the DevTools Console: ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Global_Variables_11_thumb_0_0(1).jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) If your Administrator selected **Server-Side Only**, use the [Server Side Execution Testing](https://docs.unqork.io/docs/how-to-use-the-server-side-execution-testing-page) page to view the global variable. Knowing where to look for your global variables will help if any issues arise. Here’s how your global variable looks in the Remote Execute Debugger of the Server Side Execution Testing page: ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Global_Variables_12_thumb_0_0(1).jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) **Classic Designer** ## Preconfiguration In this how-to guide, you'll create a variable to reference your current environment level using [Global Variables Administration](/v1/docs/global-variables-administration). Then, you’ll reference it using a [Calculator](/v1/docs/calculator-component) component. ### Add a Global Variable Begin by adding a global variable for your current environment level. This how-to guide focuses on creating a global variable for your Staging environment. 1. At the top right of the Unqork Designer Platform, click **Administration**. 2. Under Environment, select **Global Variables**. 3. At the bottom of the Global Variables page, click **New Global Variable**. 4. In the **Enter Key** field, enter `envUrl`. 5. In the **Enter Description** field, enter `Staging URL`. 6. Clear the **Server-Side Only** checkbox. > You must be an Administrator to create global variables, but you can still view the environment level’s variables in the DevTools Console, as long as **Server-Side Only** is deselected. 7. In the **Enter Value** field, enter your Staging environment's URL. The formatting is: `{your-environment}-staging.unqork.io`. ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/UD_Add_GlobalVariable(1).jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) 8. In the **Actions** column, click **Save**. ## Configuration > [!NOTE] > These instructions assume you have a module open, saved, and with a title. ### Configure the Initializer Component Now that you have your global variable, configure a module to reference it. 1. In the Module Builder, drag and drop an **Initializer** component onto your canvas. 2. In the **Property ID** and **Canvas Label Text** fields, enter `initOnLoad`. 3. From the **Trigger Type** drop-down, select **New Submission**. 4. In the **Outputs** table, enter the following: | Property ID | Type | Value | | --- | --- | --- | | calcEnvUrl | trigger | GO | > [!NOTE] > This Property ID corresponds to the Calculator component you'll set up next. ![A static image displaying the Settings for an initializer with triggers and outputs for a submission process.](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/CD_GV_INIT.jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) 5. Click **Save & Close.** ### Configure the Calculator Component Next, configure a [Calculator](/v1/docs/calculator-component) component to reference the global variable. To reference your global variable, you must input it as `vars.Key`. In this example, the input is `vars.envUrl`. Then, output the value to a [Hidden](/v1/docs/hidden-component) component you’ll configure next. 1. Drag and drop a **Calculator** component onto your canvas, placing it below your `initOnLoad` **Initializer** component. 2. In the **Property ID** and **Canvas Label Text** fields, enter `calcEnvUrl`. 3. In the **Inputs** table, enter the following: | # | Property ID | Alias | Required | | --- | --- | --- | --- | | 1 | vars.envUrl | E | ![](https://files.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Checked_Box(11).png) (checked) | 4. In the **Outputs** table, enter the following: | # | Property ID | Formula | | --- | --- | --- | | 1 | envUrl | =E | ![A static image displaying the Calculator settings showing property IDs and required fields for input and output actions.](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/CD_GV_Calc.jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) 5. Click **Save & Close**. > [!TIP] > Alternatively, you can input `vars` as the Property ID and use the output formula: `=GET(E, 'envUrl')`. This formatting works for any global variable key: `=GET(E,'Key')`. You can also use global variables directly in a [Calculator](https://docs.unqork.io/docs/calculator-component) and [Plug-In](https://docs.unqork.io/docs/plug-in-component) component using the following syntax: `vars.globalVarName`. ### Configure the Hidden Component Lastly, configure a [Hidden](https://docs.unqork.io/docs/hidden-component) component to store the value of your global variable. 1. Drag and drop a **Hidden** component onto your canvas, placing it below your `calcEnvUrl` **Calculator** component. 2. In the **Property ID** and **Canvas Label Text** fields, enter `envUrl`. 3. Set **Store Data in Database** to ![A toggle switch indicating an on/off state for a user interface element.](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Group 1.png?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) **(ON)**. 4. Click **Save**. 5. **Save** your module. Here’s how your completed module looks in the [Module Builder](https://docs.unqork.io/docs/introduction-to-the-module-builder): ![A static image displaying the module builder configuration showing functions initOnLoad and calcEnvUrl in a programming environment.](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/CD_GV_modulebuilder.jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) You must be an Administrator to create global variables, but you can still view the environment level’s variables in the DevTools Console, as long as **Server-Side Only** is deselected. Here’s how your global variable looks in the DevTools Console: ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Global_Variables_11_thumb_0_0(1).jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) If your Administrator selected **Server-Side Only**, use the [Server Side Execution Testing](https://docs.unqork.io/docs/how-to-use-the-server-side-execution-testing-page) page to view the global variable. Knowing where to look for your global variables will help if any issues arise. Here’s how your global variable looks in the Remote Execute Debugger of the Server Side Execution Testing page: ![](https://cdn.us.document360.io/15548f06-2fba-434c-b0c1-5df88317dbd7/Images/Documentation/Global_Variables_12_thumb_0_0(1).jpg?sv=2026-02-06&spr=https&st=2026-11-07T17%3A57%3A51Z&se=2026-11-07T18%3A57%3A51Z&sr=c&sp=r&sig=xLQI6NYYa3%2F1kOAhJCCESuzAlGyYQL4%2BD%2Fm8xgA7vEU%3D) A key-value pair is a fundamental data structure where a unique "key" is associated with a specific "value," used for organizing and retrieving data efficiently, like in dictionaries or databases. In Unqork an application is a program used to perform specific tasks. An application can be one of two types: workflow or module. The Staging environment is the first level of application building in Unqork. Use it to build, test, and style your applications. Use the UAT (user acceptance testing) environment to realistically test and navigate your applications as end-users would use them. Also known as Record Data. Submission data consists of information saved by Unqork components. View submission data by using the angular command, or in Record Collections. An object is a type of data structure that represents a single, self-contained entity that acts as a container for the characteristics of that entity. A URL (uniform resource locator) is a unique identifier used to locate a resource on the internet. Also known as a web address. APIs (application programming interfaces) are a set of protocols and definitions developers use to build and integrate application software. APIs act as the connective tissue between products and services. Authentication secrets are a value of confidential information. For example, a password, security token, or cryptographic key, that is used to verify a user's identity during the authentication process to grant access to a system or application. The DevTools Console helps you securely store, build, test, and deploy your software. A Property ID is the unique field ID used by Unqork to track and link components in your module. Canvas Label Text indicates the purpose of the corresponding field or component. For non-input components, the Canvas Label Text isn't end-user facing, and only appears in the . Deteremines how the component triggers. The component fires when the page or called module loads without an existing submission ID. Dashboards and remote execute modules are great uses for this trigger. Enter outputs components and actions you want the component to perform. Enter inputs components and actions you want the component to perform.. The DevTools Console helps you securely store, build, test, and deploy your software.