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.

SKIP AHEAD TO 
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"

    _Draft__V1.21_Wiki_2020-12-23_17-44-15.png

  2. Go to "Environment Variables”

    _Draft__V1.21_Wiki_2020-12-23_17-45-01.png

  3. Click "+ New Variable"

    _Draft__V1.21_Wiki_2020-12-23_17-45-37.png


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

    Notes:
  • If “Hide Value” is checked, values will be hidden and replaced with 5 asterisks (*).
  • Environment variables with hidden values cannot be edited.

    _Draft__V1.21_Wiki_2020-12-23_17-46-08.png

 

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.

    _Draft__V1.21_Wiki_2020-12-23_17-40-42.png

  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”.

    _Draft__V1.21_Wiki_2020-12-23_17-41-49.png

  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.

    _Draft__V1.21_Wiki_2020-12-23_17-42-38.png

    What your users will see:

    _Draft__V1.21_Wiki_2020-12-23_17-43-04.png

    Note: If the environment variables values are hidden,”*****” will be displayed when referenced.