Skip to end of metadata
Go to start of metadata

Project variables are set before runtime of the operation and become available to use across your project, for example within sources/targets, scripts, and transformations.

Project variables are first created via Design Studio. Once a project variable is created, you may set values for them either through Design Studio, the Management Console, or Citizen Integrator, providing the flexibility to set and change parameters and credentials without redeploying the project.

Common uses of project variables include for endpoint credentials, filenames, or variables that can change from environment to environment. Or, any variable that you want to be able to edit through the the Management Console or Citizen Integrator.

Create and Update Project Variables

You can create and update project variables from within Design Studio, as well as update project variables from the Management Console and Citizen Integrator.

Design Studio

Within your project within Design Studio, there are several ways to create a new project variable:

  • Go to File > New > New Project Variable.
  • In the tree on the left, right-click on the Project Variables section and select New Project Variable.
  • In the top toolbar, click the formula icon .

A configuration screen will open in the main view of Design Studio where you can edit your project variable. You can also get back to the existing project variable configuration at any time from the tree on the left under Project Variables.

The project variable configuration screen should look similar to the example provided below. Each configurable option is explained as follows.

  • Name: The name field is used for the actual variable name that you want to declare. The name field cannot be left empty, and must not contain spaces. The name entered here will replace the default "NewProjectVariable" placeholder as seen in the tree on the left. You cannot leave the name of the project variable as the default placeholder.

    NOTE: When creating new project variables, it can be a good idea to prefix your project variables so that they are easy to look up later. For example, a project variable org.netsuite.auth.username is first prefixed with org, then netsuite, etc. to effectively organize it in a list among other project variables.

    WARNING: If you plan to use your project variables in JavaScript later, it is recommended to use underscores instead of periods. More information is provided below in Use Project Variables in Scripts or Transformations.

  • Default Value: Enter a default value for the project variable if applicable. If you do not want a default value, leave this field blank. The default will be used as the initial value, which can be modified later through scripting.

  • Hide Value: Select the checkbox to hide the project variable value by replacing it with asterisks in various places throughout the user interface. You may want to use this if the value contains sensitive information that you do not want to be visible on the screen. Clearing the checkbox will remove any value entered as the Default Value.

    CAUTION: Hiding the value does not prevent the value from being accessible in a script.
  • Label: Enter a label to describe the variable name if desired. This label will show up when you hover over the variable in scripts.
  • Description: Enter a description to provide further details about the variable if desired.

Management Console

Once a project variable is created, you can also edit it remotely from the Management Console under the Projects page in the Project Variables tab.

To open the project variable for editing, use the Action dropdown to select Edit.

In the popup, you can edit the value, show or hide the value, or edit the description.

CAUTION: Any edits to project variables via the Management Console take effect immediately.

Citizen Integrator

Once a project variable is created, it can also be used within recipes. See Citizen Integrator - Configure Recipe for more information.

Use Project Variables in Scripts or Transformations

In Design Studio, the value of a project variable can be returned using either Jitterbit script or JavaScript.

Jitterbit Script

In scripts and transformations, you can use the Get function or begin with a dollar sign $ to retrieve the value of a project variable.

  • Get: Using the Get function, the example of Get("org.netsuite.auth.username") gets the value (or field in a transformation) of the project variable called org.netsuite.auth.username.
  • $: Beginning with a dollar sign $, the example of $org.netsuite.auth.username returns the same value (or field in a transformation).

JavaScript

In JavaScript used within scripts created within an operation, the syntax used for retrieving the value of a project variable depends on whether the project variable name contains a period.

  • Name does not use periods: The value of a project variable that does not contain any periods in its name can be retrieved by beginning with a dollar sign $.
    • $: Beginning with a dollar sign $, the example of $org_netsuite_auth_username gets the value of the project variable called org_netsuite_auth_username.
  • Name uses periods: The value of a project variable that contains periods in its name can be retrieved only with the Jitterbit.GetVar function.

    • Jitterbit.GetVar: Using Jitterbit.GetVar, the example of Jitterbit.GetVar("$Server.URL") returns the value of the project variable called org_netsuite_auth_username. Note that the dollar sign $ must be included within the variable name.

Use Project Variables in Definition Screens

In a definition screen (during the configuration of sources or targets), you can reference project variables using the [ProjectVariableName] syntax.

For example, if you're using the project variable as part of a filename or as a property of a different object that is not in a script, then you can reference it using brackets such as [org.netsuite.auth.username].

You can define a default value in curly brackets { } immediately following the project variable name within the square brackets [ ]. For example:[org.netsuite.auth.username{example@example.com}].

Though you can use variables when specifying a value of a configuration field, the default values of the variable values will not work when testing in scripts, Script Pad, or using Formula Builder Debugging. The default values will work when the script is run as part of an operation or at runtime.

To use variables to define value of a configuration field and test them in scripts or with Script Pad, you will need to either set explicit values using a script or define default values using curly brackets. Note that these default values will not be used at runtime if any other default values have been set in the project variable creation/update (in Design Studio), in the Management Console, or in Citizen Integrator.

NOTE: As a best practice, the default value should be set during project variable creation/update (in Design Studio), in the Management Console, or in Citizen Integrator, rather than using the curly bracket syntax. A default value specified using the curly bracket syntax will take effect at runtime only if the default value defined using the other means is left blank.

On This Page

Last updated:  Feb 14, 2019