Skip to end of metadata
Go to start of metadata

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 project
  • recordType: 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

Script 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]

Picklist Example

  1. Go to NetSuite's SuiteTalk Schema Browser.
  2. From the Records section in the upper left, select relationships.xsd, and then select Customer from the resulting list. The page will display the Customer Record table showing the structure of the Customer Record, and in particular the field names and types available. A "record type" in NetSuite is similar to a Jitterbit object or table name. Record types are case-sensitive.
  3. If you are using a Jitterbit Harmony NetSuite Search activity, its schema has the field entityStatus. You can preview the values for this field for when previewing a transformation using this schema.
  4. To retrieve all the picklist values for the field entityStatus under the customer record type, use a script such as:

    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
  5. This will return a list of keys, such as:

    {CUSTOMER-Closed Won,CUSTOMER-Lost Customer,CUSTOMER-Renewal}
  6. You can then test the script using script testing to see the internal and external IDs for each of the three 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 Jitterbit 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=/"

On This Page

Search in This Topic

Last updated:  Mar 10, 2020

  • No labels