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 SOAP Schema Browser for the version of NetSuite WSDL you are using. This example uses the 2021.1 SOAP Schema Browser.
  2. 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 the customer record, including its field names and field types. Record types are case-sensitive.
  3. In the Name column of the customer record table, locate the field name entityStatus. This corresponds with the field entityStatus 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.

  4. To retrieve all the picklist values for the field entityStatus under the customer 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}
  5. 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 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=/"

 

  • No labels