NetSuite functions in Jitterbit Integration Studio
NetSuite functions provide login and session information and lookups for NetSuite instances.
NetSuiteGetSelectValue
Declaration
dictionary NetSuiteGetSelectValue(string netSuiteOrg, string recordType, string field[, string sublist])
Syntax
NetSuiteGetSelectValue(<netSuiteOrg>, <recordType>, <field>[, <sublist>])
Required parameters
netSuiteOrg
: A string reference path to a NetSuite connection in the current projectrecordType
: NetSuite record type (see Picklist Example below)field
: NetSuite field
Optional parameters
sublist
: NetSuite sublist
Description
Retrieves the picklist values for a field from NetSuite.
The function response is a dictionary (map), where:
- The dictionary keys are the picklist values.
- The dictionary values are a map with two elements: the internal ID and the external ID for each picklist.
Note
The return value should be assigned to a variable and the variable should be used for retrieving corresponding IDs for picklist elements instead of calling this function multiple times.
Note
If sublist
is given inappropriately, you may get
ERROR code=INSUFFICIENT_PERMISSION;message=You do not have permissions to set a value for element cef records
due to any of these reasons:
- The field is read-only.
- An associated feature is disabled.
- The field is available either when a record is created or updated, but not in both cases.
Examples
Basic example
netSuiteOrg = "<TAG>endpoint:netsuite/NetSuite</TAG>";
recordType = "customer";
field = "entityStatus";
dict = NetSuiteGetSelectValue(netSuiteOrg, recordType, field);
i1=dict[field]["internalId"]; // or dict[field][0]
e1=dict[field]["externalId"]; // or dict[field][1]
Sublist example
netSuiteOrg = "<TAG>endpoint:netsuite/NetSuite</TAG>";
recordType = "salesOrder";
field = "item";
sublist = "itemList";
dict = NetSuiteGetSelectValue(netSuiteOrg, recordType, field, sublist);
i1=dict[field]["internalId"]; // or dict[field][0]
e1=dict[field]["externalId"]; // or dict[field][1]
Picklist example
-
Go to NetSuite's SOAP Schema Browser for the version of NetSuite WSDL you are using. This example uses the 2021.1 SOAP Schema Browser.
-
Go to the Records Browser tab and navigate to the Customer record type. The resulting page displays the
customer
record table showing the structure of thecustomer
record, including its field names and field types. Record types are case-sensitive. -
In the Name column of the
customer
record table, locate the field nameentityStatus
. This corresponds with the fieldentityStatus
shown in the schema of a NetSuite Search activity. You can preview the values for this field for when previewing a transformation using this schema. -
To retrieve all the picklist values for the field
entityStatus
under thecustomer
record type, use a script:netSuiteOrg = "<TAG>endpoint:netsuite/NetSuite</TAG>"; recordType = "customer"; field = "entityStatus"; d = NetSuiteGetSelectValue(netsuiteOrg, recordType, field); keys = GetKeys(d); $cw.internalId = d[keys[0]]["internalId"]; $cw.externalId = d[keys[0]]["externalId"]; keys
This script will return a list of keys:
{CUSTOMER-Closed Won,CUSTOMER-Lost Customer,CUSTOMER-Renewal}
-
You can then test the script to see the internal and external IDs for each of the picklist entries.
NetSuiteGetServerTime
Declaration
string NetSuiteGetServerTime(string netSuiteOrg)
Syntax
NetSuiteGetServerTime(<netSuiteOrg>)
Required parameters
netSuiteOrg
: A string reference path to a NetSuite connection in the current project
Description
Retrieves the server date-time from a NetSuite server.
Examples
netSuiteOrg = "<TAG>endpoint:netsuite/NetSuite</TAG>";
NetSuiteGetServerTime(netSuiteOrg);
// Returns a date such as "2017-12-07T21:00:26.000-08:00"
NetSuiteLogin
Declaration
string NetSuiteLogin(string netSuiteOrg)
Syntax
NetSuiteLogin(<netSuiteOrg>)
Required parameters
netSuiteOrg
: A string reference path to a NetSuite connection in the current project
Description
Retrieves a new session ID from a NetSuite endpoint for use in REST or SOAP calls that are used outside of the NetSuite connector. This provides a simple way to log in to NetSuite without requiring authentication headers for each web service call.
Note
Use of this function is not required if you are using the Harmony NetSuite Connector.
Warning
The NetSuite session expires after 15 minutes. It may be invalidated by other calls to NetSuite.
Examples
netSuiteOrg = "<TAG>endpoint:netsuite/NetSuite</TAG>";
NetSuiteLogin(netSuiteOrg);
// Returns a string such as
// "JSESSIONID=_wXox...847; path=/; HttpOnly;NS_ROUTING_VERSION=LAGGING; path=/;NS_VER=2017.2.0; path=/"