Getters

Overview

Variables are useful objects for storing data that might change depending on settings, environments, or other factors. Getters are a type of variable whose values aren't defined by the module's definition. Other data sources define these variables, like environment data or user data. In other words, a creator doesn't configure a getter by setting the component's Property ID. Other data sources define these variables, like environment data or user data.

You can reference getters anywhere you reference a Property ID. For example, the Inputs and Outputs Tables of Data & Event Processing components. When you execute the module in Express View or use the Server Side Execution Testing page, you can see all the available getters.

You also see the corresponding get functions that are responsible for loading the getter in the submission. For example, the getVars function loads the vars object. And the get getEnv function loads the getEnv object.

TIP  To learn more about using the Server Side Execution Testing page, visit our How to: Use the Server Side Execution Testing Page article.

Below you can see the vars object in the DevTools Console:

What You’ll Learn

In this article, you’ll learn:

What Getters Are Available?

Below is a list of getters and their descriptions:

Setting Description

getBrowser

Displays browser status (online) as a Boolean value. This is used with Unqork's Offline Mode to make connectivity-based decisions.

TIP  For more information on Offline Mode, visit our Introduction to Offline Mode article.

getEnv

Contains information about the environment your application is in, including the Customer and Environment Group.

getMetadata

Stores metadata. You can pass key/value pairs that aren’t stored in the data object but stored in metadata instead.

getModuleFields

Contains the JSON definition of the module and all the components in the module.

getSubmissionFields

Contains the created, id, modified, moduleId, and userId key/value pairs, among others.

TIP  If you want to reference these values in your module, they're available in the currentUser object.

vars

Contains global variables.

TIP  For more information on global variables, visit our Global Variables Administration article.

getWorkflowNavigationSteps

Displays information about the name, path, valid, current step, and visited information for all steps in the workflow navigation header.

integratorErrors

Returns integration error information to the user. Gives information on the error and is specific to APIs.

validationErrors

Returns validation error information to the user. Shows fields that are not valid based on the rules you set. This getter is like integrationErrors, but not specific to APIs.

NOTE  The validationErrors array exposed on the Server Side Execution Testing page gives more comprehensive error information.

_getData

Retrieves all data from the module, like the Angular command. The Angular command can’t be accessed via configuration, but _getData can.

_query

Contains parameters passed to modules in the URL. Module parameters passed in the URL can only be referenced with get _query.

Now that you know the available getters, here's how to use them.

How to Reference a Getter

Getters and their associated values are part of the submission data object. To understand what information exists in each getter, you can inspect the submission data object.

To inspect submission data in the DevTools Console:

1. Open your submission in Express View.
2. Right-click anywhere on the page.
3. Select the Inspect option.

TIP  To open the DevTools Console in Google Chrome, you can use the Ctrl + Shift + J (Windows/Linux) or Option + Command + J (Mac OS) shortcut.

4. In the DevTools Console, enter the following Angular command: angular.element('.unqorkio-form').scope().submission.
5. Press the Enter/Return key.
6. Click the gray arrows to expand the submission object's structure.
7. Expand the data key to reveal your submission data object.

From there, you can expand and inspect the available getters.

To reference a value stored under a getter object or array, reference its property path. For example, to reference the CUSTOMER value in the getEnv getter, use the property path getEnv.CUSTOMER. In some cases, you need to include a data. prefix when referencing values in the submission object within your configuration. For example, if referencing the value in a Content component.

TIP  For a sample use case that shows how to reference a getter in your configuration, see our How to: Reference a Global Variable in a Component article.

Resources