This page describes how to use NetSuite token-based authentication (TBA) by calling a RESTlet from a local file source in Jitterbit Harmony. Prior to configuring TBA in Jitterbit Harmony, see Jitterbit's recommendations for enabling TBA in NetSuite.
Calling a RESTlet from a local file source is one of several ways to use NetSuite TBA with Harmony. Other options include using the NetSuite Connector (recommended), calling a RESTlet from an HTTP source or target, or using a web service method:
- Using NetSuite TBA in the NetSuite Connector
- Using NetSuite TBA by Calling a RESTlet from an HTTP Source or Target
- Using NetSuite TBA in a Web Service Method
While the NetSuite Connector is recommended, it may be preferred to call the RESTlet or use a web service method in some cases, such as for existing integrations that are already designed in this way, or where certain features are not available with the connector. No matter the method you use, authenticating using TBA is available in all of these. Note that the RESTlet method described on this page is available only with Private Agents.
To call a RESTlet to authenticate with NetSuite TBA using a local file source, these steps are recommended, as covered on this page:
- Associate the RunCommand Plugin
- Install Node.js
- Create the Node.js File
- Call the Node.js File in a Script
- Process the RESTlet Response
To use NetSuite TBA by calling a RESTlet from a local file source in Jitterbit Harmony, these criteria must be met:
- You must have the appropriate permissions role on your NetSuite account.
- You must be using SuiteTalk version 2015.2 or higher.
You must have TBA enabled for your NetSuite account.
TIP: For additional information, refer to the NetSuite documentation on Getting Started with Token-based Authentication (login to NetSuite required).
You must be using a Jitterbit Harmony Private Agent (Linux or Windows) and have Node.js and npm installed (covered in the instructions below).WARNING: This method is not available for use with Cloud Agents, as it requires the use of local files and being able to run a command where the file is located.
Associate the RunCommand Plugin
The use of the RunCommand plugin is required in order to execute a Node.js file that will be created later. In order to use this plugin, you must first associate it with your Private Agent Group. This will make the plugin available on all Private Agents within the Private Agent Group.
To associate the plugin:
- Log in to the Harmony Portal and go to the Management Console. Then use the menu in the top left to navigate to Customizations > Plug-ins.
- In the table, locate the row "Jitterbit - Run Command." On the far right, use the Action dropdown to select Associate Agent Group.
- In the popup, select your Private Agent Group and click Save.
Node.js must be installed in order to run a file that will be created later to call the RESTlet from Jitterbit Harmony. The npm program, which is used to manage Node.js packages, is also required and is usually included with Node.js.
In this step, check whether Node.js and npm are installed on your Private Agent(s), and if they aren't, install them.
Check to see if Node.js is installed.
Check to see if npm is installed.
If either command does not respond with a version, use these commands to install the application that is needed:
Create a new directory that will be used later as the location of the NetSuite call and response. This can be changed to any desired location and will need to be provided later in your Jitterbit Harmony project.
Navigate to the new directory.
Install these required Node.js packages.
Create the Node.js File
This is the file that you will need to call the RESTlet from Jitterbit Harmony.
request.js for reference.
Call the Node.js File in a Script
To use the Node.js file created in the previous step, set up a Jitterbit Script that sets TBA variables and calls the Node.js file using the RunCommand plugin.
- In Design Studio, create a new Jitterbit Script as a project item.
Within the script, paste the contents below into the Jitterbit Script. In the sample Jitterpak, this script is named
- Create a script operation and place the Jitterbit Script within it. In the sample Jitterpak, the operation is called
- To verify that you have successfully connected to NetSuite, test the operation to ensure you receive something back from the RESTlet.
Process the RESTlet Response
Now that the call to NetSuite is set up, you can then proceed with setting up the rest of your project using the response you receive back from the call.
- Create a local file source with the location on your Private Agent where you specified for the response to be written.
Create a transformation operation that uses the local file source you just created containing the response from NetSuite. In the sample Jitterpak, the operation is called
02-Process_RESTlet_Response. The operation setup should look similar to that below.
- In the transformation, you can then use the NetSuite response however you would like, completing the mapping as usual.
If the Node.js call does not appear to be working from Jitterbit Harmony, or if the files are not writing on the Agent, you may need to adjust the permissions of the folder with the NetSuite call and response. A simple test is to provide full access to everyone, and test the operation again. If that solves the problem you will need to adjust the directory permissions to allow the Jitterbit user/group access to read and write in the created folder.
If the RunCommand plugin returns errors, ensure that you have filled in all of the project variables with the necessary NetSuite information.
Last updated: Oct 26, 2018