Use a naming convention for variables in Jitterbit Integration Studio
Introduction
This page provides guidance on user-provided names of local and global variables.
Types of variables
Harmony has four types of variables:
- Local Variables: Defined and accessed in a single Jitterbit Script or JavaScript. Scope limited to the script.
- Global Variables: Defined in a Jitterbit Script or JavaScript and available across a project.
- Project Variables: Defined in the Integration Studio UI and available across a project. Updateable through the Management Console.
- Jitterbit Variables: Predefined in Harmony or defined in a private agent's configuration file. Available across a project.
Local variables
As the scope of a local variable is limited to a single script, a naming convention for them can be very simple, such as all-lowercase letters or an initial word, such as return
or myVariable
. Periods are not allowed in local variables.
Global variables
Global variables, as their scope is larger (a global variable is available to be referenced in the same or downstream operations and scripts within an operation chain), should use a consistent naming convention to avoid confusion. For example, using multiple components for a variable name, separated by underscores, you could follow a pattern such as this:
type_name
Component | Description |
---|---|
type | A short abbreviation identifying the variable type, such as pv (project variable), gv (global variable), io (endpoint source/target name), dict (dictionary), etc. |
name | A logical name for the variable, such as purchase_orders , categories , ids , etc. Additional underscores can be used as needed. |
Combining these components, these are possible variable names:
$pv_shopify_base_url
$dict_staples_po_line_items
$io_request
$gv_sfdc_workorder_id
Since variables are sorted alphabetically in various places throughout the UI, organizing them hierarchically will assist with managing and using variables.
Whatever convention you choose to use, we recommend codifying and documenting it so that all team members can consistently use it in all projects.
Note
If you plan to use Jitterbit Script global variables in a JavaScript script, it is important to use underscores instead of periods:
$example_arr_names
$example_sfdc_success_message