View Jitterbit Developer Portal
Introduction
All transformation mappings are made up of scripts on individual nodes and fields within a target schema.
You do not necessarily need to manually create those scripts in order to create the mapping; many mappings are created visually, such as by dragging and dropping source objects or variables to a target field, but they result in a script being created behind the scenes. Regardless of the method used to create the mapping, the result is always the same: a script on a target node or target field.
This page covers how to open transformation scripts and reference project components and functions within them, although note that any valid script logic can be used.
Opening a Field Script
Before you can add script logic, you need to enter the view that allows you to edit the script for an individual field or node. Adding a script on a node is covered separately under Conditional Mapping.
Adding a Script
Adding a script on a field can be done from either mapping mode or script mode. To add a new script on a target field, do one of the following:
- Double-click the field name.
- Hover over the target field and click the add icon
This opens the editable script area on the target field in script mode, where you can enter or edit the script logic for the mapping.
Editing a Script
To edit a script on a target field that already has a mapping, either double-click the field name or click the script icon
in the top right of a target field.This opens the editable script area on the target field in script mode, where you can enter or edit the script logic for the mapping.
Entering or Editing Script Logic
On adding or editing a script, the editable script area opens on the target field in script mode, where you can enter or edit the script logic for the mapping:
Below the script area, text indicates whether the script is valid. For information on script validation, see Jitterbit Script.
Toggling the Script Area
To toggle the script area back to the original block display, click the collapse icon
.Opening the Full Script Editor
To work within a larger script area, click the popout icon script editor. After opening the full script editor, click the return icon to come back to this screen.
in the upper right of the target field to open the fullRemoving the Script
To remove the script, simply delete the text of the script.
Adding a Source Object
Within the component palette, a list of functions available to use in a script is provided within the Source Objects tab:
Within a transformation script, you can reference source data by inserting a field's reference path, or you can reference source data nodes by inserting a node's reference path.
To add a field or node reference path to a transformation script (Jitterbit Script only), use one of these methods:
Refer to Mapping Source Objects for detailed information about mapping source objects, including by adding a source object to the script. For additional details, see Source Objects in Jitterbit Script.
Adding a Function
Within the component palette, a list of functions available to use in a script is provided within the Functions tab:
Within a script, you can use functions by inserting the function syntax appropriate for the script language.
To add the function syntax to a script (Jitterbit Script or JavaScript), use one of these methods:Control+Space
to display a list of autocomplete suggestions. Select a function to insert the function syntax.
For more information, see the documentation for each function by category under Functions.
Adding a Variable
Within the component palette, a list of variables available to use in a script is provided within the Variables tab:
Within a script, you can use variables by inserting the variable syntax.
To add the variable syntax to a script (Jitterbit Script or JavaScript), use one of these methods:Control+Space
to display a list of autocomplete suggestions. Select a variable to insert the variable syntax.
Refer to Mapping Variables for detailed information about mapping variables, including by adding a variable to the script. For additional details, see Variables in Jitterbit Script.
Adding a Plugin
Within the component palette, a list of plugins available to use in a script is provided within the Plugins tab:
Within a script, you can use a plugin as an argument for the RunPlugin
function by inserting the plugin reference path.
To add a plugin reference path to a script (Jitterbit Script only), use one of these methods:RunPlugin
function and the plugin reference.Control+Space
to display a list of autocomplete suggestions. Select a plugin to insert the plugin reference.
For additional details, see Plugins in Jitterbit Script.
Adding an Operation
Within the component palette, a list of operations available to use in a script is provided within the Operations tab:
Within a script, you can use an operation as an argument for functions by inserting the operation reference path.
To add an operation reference path to a script (Jitterbit Script only), use one of these methods:RunOperation
function and the operation reference.Control+Space
to display a list of autocomplete suggestions. Select an operation to insert the operation reference.
For additional details, see Operations in Jitterbit Script.
Adding a Notification
Within the component palette, a list of notifications available to use in a script is provided within the Notifications tab:
Within a script, you can reference a notification as an argument for the SendEmailMessage
function by inserting the notification reference path.
To add a notification reference path to a script (Jitterbit Script only), use one of these methods:SendEmailMessage
function and the notification reference.Control+Space
to display a list of autocomplete suggestions. Select a notification to insert the notification reference.
For an example, see Notifications in Jitterbit Script.
Adding a Script
Within the component palette, a list of other scripts that are available to use in a script is provided within the Scripts tab:
Within a script, you can reference another script as an argument for the RunScript
function by inserting the script reference path.
To add a script reference path to a script (Jitterbit Script only), use one of these methods:RunScript
function and the script reference.Control+Space
to display a list of autocomplete suggestions. Select a script to insert the script reference.
For an example, see Scripts in Jitterbit Script.
Adding Endpoints
Within the component palette, a list of endpoints that are available to use in a script is provided within the Endpoints tab:
Within a script, you can reference endpoints as an argument for functions by inserting the connection or activity reference path.
To add a connection or activity reference path to a script (Jitterbit Script or JavaScript), use one of these methods:Control+Space
to display a list of autocomplete suggestions. Select a connection or activity to insert the appropriate reference.
Depending on the endpoint, you can then use the Functions tab to add functions for which to use the connection or activity reference as an argument.
For additional details, see Endpoints in Jitterbit Script.
Removing a Mapping
You can remove target field mappings one at a time (Remove a Single Field Mapping) or all at once for all field mappings contained within a node (Remove Multiple Field Mappings).
Removing a Single Field Mapping
To remove a single script mapping from a target field (sometimes referred to as unmapping a field), clear the contents of the target field script.
Removing Multiple Field Mappings
For mappings on hierarchal schemas, options for removing multiple target field mappings are available within a node's actions menu.
From either mapping mode or script mode, hover over a node name and click the actions menu icon to open the actions menu. From the menu, select one of these mapping removal options:
Menu Item | Description |
---|---|
Remove Loop Node and Mappings removes the loop node definition due to mappings that are direct leaf children associated with the loop node, and removes those mappings. Any other mappings within child loop nodes beneath the parent loop node are preserved, and the node retains its loop node definition if at least one grandchild is mapped. This action is available only on nodes that have a loop node defined (either manually or by automatic generation). | |
Remove All Mappings Beneath This Node removes all mappings on fields contained within the node, as well as all mappings on fields contained within child nodes of that node. Using this action on a root node removes all mappings in a transformation. On selecting this action, a message asks you to confirm that you want to remove mappings. | |
Remove All Invalid Mappings removes all invalid mappings on fields contained within the node, as well as all invalid mappings on fields contained within child nodes of that node. For more information about invalid mappings, see Transformation Mapping Validity. |