Environment Variables

Premium Checkbox Feature

Usage of this feature requires account access to Premium Checkbox features. For queries related to your licence agreement, ask your account administrator to contact your Checkbox Account Manager.

What is an environment variable
When should I use environment variables?
How to create environment variables
How to reference environment variables

What is an environment variable?

Environment variables are variable values available to any user within the company environment to reference within an App using a JS API. See below for Instructions to reference environment variables in your Apps.


When should I use environment variables?

Some common use cases for environment variables include (but not limited to) SharePoint domains and API Keys for systems (e.g., Salesforce, payment gateways etc).


How to create environment variables

  1. Click onto your user name and go to "Account Settings"


  2. Go to "Environment Variables”


  3. Click "+ New Variable"


  4. Enter the details for the new environment variable and select to either show or hide the variable value.

    Note: If “Hide Value” is checked, values will be hidden and replaced with 5 asterisks (*).



How to reference environment variables

The following instructions will assume you understand how to use the JS block. Learn more about the JS Block.

  1. Create a JavaScript snippet with the JS API for environment variables

    For example:
    To retrieve the unique value of the environment variable named “SharePointDomain”, you can use the following JavaScript snippet (2 lines).

    const A1 = api.env('SharePointDomain’);
    api.setVariable('OutputSPDomain’, A1);

    Note: A single JS snippet can hold multiple JS API calls to retrieve the unique environment variable values. However, you must ensure that the identifierName, environmentVariableName and outputJSValue are changed respectively. See screenshot of the JS snippet below.


  2. Drag in a JS Block and upload the JS snippet

  3. Create an output variable and enter the output JS variable from the JS snippet

    Following on from the previous example to retrieve the unique value of the environment variable with the name “SharePointDomain”, set up the JS block as shown in the following screenshot where the output JS variable in the JS snippet is “OutputSPDomain”.


  4. Reference the Checkbox Variable in your App where necessary.

    Following the same example for the “CompanyEmail” environment value, TXT11 (output JS variable generated from the JS Block) can now be referenced in your App. See screenshot below.


    What your users will see:


    Note: If the hidden environment variables values are referenced using a JS snippet, the value will be displayed.