Oracle NetSuite RESTlet
RESTlet Installation
To enable REST APIs in NetSuite, a “RESTlet” file must be deployed in your NetSuite account.
To support the NetSuite Connector, Cyclr has its own RESTlet file. Please get in touch with your Support Team to request this.
Once you have the Cyclr RESTlet file, follow the steps in this documentation.
Locating your NetSuite Account ID
Your NetSuite Account ID is required when installing the NetSuite Connector within Cyclr and is found in your NetSuite account.
In NetSuite to go Setup > Company > Company Information
Then look for ACCOUNT ID.
It might also be located under Setup > Integration > Webservice Preferences
Upload the RESTlet script to NetSuite
You can upload the RESTlet script file to NetSuite from Customization > Scripting > Scripts > New. Make sure you select RESTlet as the Type and enter the GET / POST / DELETE / PUT function names based on your RESTlet script.
Deploy the RESTlet script
Once your script is uploaded, you need to deploy the script. Make a note of the External URL which will be used when you install the NetSuite connector in Cyclr.
To locate the External URL in future, go to Setup > Scripting > Script Deployments and click the View option for the appropriate entry.
Create an integration in NetSuite
To allow Cyclr to access the RESTlet securely, you need to set up a token-based authentication in NetSuite. You can create an integration under Setup > Integration > Manage Integrations > New. Check the token-based authentication on the setup page.
Save the integration and copy the consumer key and consumer secret. You will need them when installing the NetSuite connector.
Create an access token
Create an access token from Setup > Users/Roles > Access Tokens > New. The application name should be the integration you created in the previous step. Select a user who have access to make REST calls and permissions to the objects you would like Cyclr to access.
Make a note of the token ID and token secret. Cyclr will ask for them when you install the NetSuite connector.
Set select and multiselect fields
When you set selectand
multiselectfields in a create or update method, you can either provide its
internalid(actual value in NetSuite) or
name` (UI display text in NetSuite).
Examples
{
"company": {
"internalid": "300"
},
"custentity_categories": [
{
"internalid": "1"
},
{
"internalid": "2"
}
]
}
{
"company": {
"name": "Cyclr"
},
"custentity_categories": [
{
"name": "Software"
},
{
"name": "API"
}
]
}
If both the internalid
and name
are provided, Cyclr only uses the internalid
in the RESTlet.
Filter Objects
The List methods return multiple items when you run them and you can filter the items to match specified criteria using the following fields:
Field
: (Required) The field in the NetSuite object you want to filter. For example,name
.Operator
: (Required) The operation you want to run against the field. For example,is
,greaterthan
,contains
. See the table below for an extensive list of operators and the field types you can use them with.Value
: (Optional) The value you want to compare the fields against with the Operator value.
Multiple Filter Conditions
To use more than one filter condition, you need to use some Script in the NetSuite Step to add the conditions. In the cycle builder, select the Step Setup button on the NetSuite Step, select Advanced Settings, and enter your script in the following format.
function before_action() {
// Adding a second filter:
method_request_parameters.filter_field_2 = 'fieldA';
method_request_parameters.filter_op_2 = 'equalto';
method_request_parameters.filter_val_2 = 'somevalue';
// Adding a third filter:
// (this one doesn't require a `Value` property as it uses the "isnotempty" Operator)
method_request_parameters.filter_field_3 = 'fieldB';
method_request_parameters.filter_op_3 = 'isnotempty';
return true;
}
These are the Script properties to use for each filter:
method_request_parameters.filter_field_X
method_request_parameters.filter_op_X
method_request_parameters.filter_val_X
Note: With script, you can add as many filter conditions as you need. For the script to work correctly, make sure that the numbers on the end of the properties are consecutive, without any breaks. If you add properties for
{...}_2
,{...}_3
, skip 4 and add them for{...}_5
, Cyclr ignores the fifth condition.
Define filters in script
In the List methods you can skip the filters in the connector parameters and define all of your filters in script instead. To do this you need to start the script parameters from ..._1
. For example, method_request_parameters.filter_field_1
.
Note: You need to set the Get New/Updated methods' script parameters from
{...}_2
, because the step defined the first set of parameters itself.
Operators and Valid Field Types
Search Operator | List/Record | Currency, Decimal Number, Time of Day | Date | Check Box | Document, Image | Email Address, Free-Form Text, Long Text, Password, Percent, Phone Number, Rich Text, Text Area, | Multi Select |
---|---|---|---|---|---|---|---|
after | X | ||||||
allof | X | ||||||
any | X | X | |||||
anyof | X | X | X | ||||
before | X | ||||||
between | X | ||||||
contains | X | ||||||
doesnotcontain | X | ||||||
doesnotstartwith | X | ||||||
equalto | X | X | X | ||||
greaterthan | X | ||||||
greaterthanorequalto | X | ||||||
haskeywords | X | ||||||
is | X | X | |||||
isempty | X | X | X | ||||
isnot | X | ||||||
isnotempty | X | X | X | ||||
lessthan | X | ||||||
lessthanorequalto | X | ||||||
noneof | X | X | X | ||||
notafter | X | ||||||
notallof | X | ||||||
notbefore | X | ||||||
notbetween | X | ||||||
notequalto | X | ||||||
notgreaterthan | X | ||||||
notgreaterthanorequalto | X | ||||||
notlessthan | X | ||||||
notlessthanorequalto | X | ||||||
noton | X | ||||||
notonorafter | X | ||||||
notonorbefore | X | ||||||
notwithin | X | ||||||
on | X | ||||||
onorafter | X | ||||||
onorbefore | X | ||||||
startswith | X | ||||||
within | X |
NetSuite Saved Search to return 1000+ records
To retrieve more than 1,000 records, you need to create a Saved Search in NetSuite and use the appropriate Run (object) Saved Search method in the NetSuite Connector for the type of data you're returning. For example, to return contacts, you can use the Run Contact Saved Search method.
Set your Saved Search criteria to the data you want to receive so it only returns the ID values of the objects. When Cyclr calls the search, RESTlet retrieves the full objects for the objects before it returns the data.
You can find instructions for setting up a Saved Search in the NetSuite Documentation.