Saved Search Job

Saved Search Job Configuration

SavedSearchConfig

Defines a Mitto Saved Search Job

type

object

properties

  • title

Title

See Mitto Job documentation

type

string

  • name

Name

See Mitto Job documentation

type

string

  • type

Type

IO job only

type

string

pattern

^io$

  • input

Input

Saved Search Input

allOf

SavedSearchInput

  • steps

Steps

See Mitto Job documentation

type

array

items

type

object

  • store

Store

See Mitto Job documentation

type

object

  • output

Output

See Mitto Job documentation

type

object

additionalProperties

False

definitions

  • BasicCredentials

BasicCredentials

Defines the credentials (email/password) used to invoke the RESTlet and Saved Search. Use of these is strongly discouraged.

These were the only credentials supported by the first release supporting RESTlet Saved Search. A subsequent release added support for Token-Based Authentication with RESTlet Saved Search.

It is much better/safer to use the newer TBACredentials instead of these.

type

object

properties

  • account

Account

The NetSuite account to be used. Example: "TSTDRV1762243"

type

string

  • email

Email

The email address associated with the account. Example: "zed.zuar@zuar.com"

type

string

  • password

Password

The password associated with the account/email. Example: "vpDv2yDqQL3Gch"

type

string

  • role

Role

The internal id of the Mitto User Role. Example: 1078

type

integer

minimum

1

  • url

Url

If present, the value is used in place of the URL generated by the connector. If the URL does not begin with the account number and end with restlet.nl, it is likely to be incorrect.

Example: "https://TSTDRV1762243.restlets.api.netsuite.com/app/site/hosting/restlet.nl"

type

string

additionalProperties

False

  • TBACredentials

TBACredentials

Defines credentials for use with TBA RESTlet Saved Search.

These credentials match credentials used elsewhere in the connector.

type

object

properties

  • account

Account

The NetSuite account to be used. Example: "TSTDRV1762243"

type

string

  • consumer_key

Consumer Key

The CONSUMER KEY associated with the NetSuite role to be used.

type

string

  • consumer_secret

Consumer Secret

The CONSUMER KEY associated with the NetSuite role to be used.

type

string

  • token_id

Token Id

The TOKEN ID associated with the NetSuite role to be used.

type

string

  • token_secret

Token Secret

The TOKEN SECRET associated with the NetSuite role to be used.

type

string

  • url

Url

If present, the value is used in place of the URL generated by the connector. If the URL does not begin with the account number and end with restlet.nl, it is likely to be incorrect.

Example: "https://TSTDRV1762243.restlets.api.netsuite.com/app/site/hosting/restlet.nl"

type

string

additionalProperties

False

  • Restlet

Restlet

Defines the RESTlet to be called to invoke the SavedSearch.

type

object

properties

  • script

Script

Script id of the NetSuite RESTlet that will be called to invoke the saved search. This is the argument to the script parameter of the EXTERNAL_URL found on the Script Deployment page for the Mitto Saved Search RESTlet.

Example: If the EXTERNAL URL is https://tstdrv1762243.restlets.api.netsuite.com/app/site/hosting/restlet.nl?script=641&deploy=1 the value for script should be 641.

type

integer

minimum

1

  • deploy

Deploy

Deploy id of the NetSuite RESTlet that will be called to invoke the saved search. This is the argument to the deploy parameter of the EXTERNAL_URL found on the Script Deployment page for the Mitto Saved Search RESTlet.

Example: If the EXTERNAL URL is https://tstdrv1762243.restlets.api.netsuite.com/app/site/hosting/restlet.nl?script=641&deploy=1 the value for deploy should be 1.

type

integer

minimum

1

additionalProperties

False

  • SavedSearch

SavedSearch

Parameters that control data returned by this inputter.

When used in a simple “load” job configuration, this inputter returns all records produced by the specified NetSuite saved search.

When used in an “upsert” job configuration, this inputter returns all records produced by the specified NetSuite saved search for whom the date of the last_modified_column is greater than or equal to the date of the last modified date for the job.

This inputter invokes the specified NetSuite saved search via a RESTlet. The RESTlet ultimately uses the NetSuite nlapiSearchRecord function to execute the saved search. For upserts, a search filter using the last modified date is created using nlobjSearchFilter and the onOrAfter filter.

NetSuite’s handling of the last modified date during the execution of an upsert is somewhat unusual; an understanding of it is important to getting the desired results.

  1. The last modified date from the job is provided to the RESTlet as a specially formatted string. Although a timezone is not present in the string, the implicit timezone is Pacific Time (GMT-08:00).

  2. The string is converted into a datetime object using nlapiStringToDate.

  3. When the RESTlet requests execution of the saved search using the datetime object, the following takes place:

    1. The datetime object is used to create a new datetime object with a timezone offset of GMT-08:00 (the timezone of all NetSuite datacenters). Any timezone information in the datetime object is ignored.

    2. The time of the new datetime object is set to midnight.

    3. The new datetime object is used when selecting / filtering records.

Let’s walk through an example.

  1. The MaxTimestamp for an upsert job is 2021-02-09T14:10:00+00:00.

  2. That value is converted to Pacific Time, resulting in 2/9/2021 2:10 PM. This value is passed to the saved search RESTlet.

  3. The saved search RESTlet performs an nlapiSearchRecord for lastmodified that is onOrAfter 2/9/2021 2:10 PM.

  4. NetSuite will return all records with a lastmodified that is greater than equal to 2/9/2021 12:00 AM Pacific Time.

From this is can be seen that the minimum granularity for upserts is one day / 24 hours on whole-day boundaries.

Typically, both “load” and “upsert” jobs need only provide values for saved_search_id and record_type in the job’s configuration; the remaining parameters can usually be ignored, except in special cases.

type

object

properties

  • saved_search_id

Saved Search Id

The id of the saved search that will be called by the RESTlet. This is the value of ID on the Saved Search page for the desired search.

type

string

examples

customsearch766

  • record_type

Record Type

The record type associated with the saved search to be called by the RESTlet.

type

string

examples

custentity_federal_id_num

  • last_modified_column

Last Modified Column

The column name to be used when selecting records based on last_modified_date. When defining a saved search, if the Last Modified column is added to the output, the column name assigned to it by NetSuite is lastmodifieddate. Because the default value of this parameter is lastmodifieddate, it is not necessary to specify this parameter in a job unless it is desired to use a different column when selecting records.

type

string

examples

timestamp

default

lastmodifieddate

  • last_modified_date

Last Modified Date

If last_modified_date is None, the last modified date for an upsert job is provided by the steps in the job’s configuration.

If a value is provided for this parameter, it overrides any value obtained from the steps of the job. The value must be formatted so that it exactly matches the date_time_format in use.

Important: This value must be in the NetSuite dataceter timezone which is Pacific Time (e.g.: America/Los_Angeles / GMT-08:00).

For example, to use January 12, 2021 3:45 PM CDT, provide a value of "1/12/2021 1:45 pm" (assuming the default date_time_format).

type

string

examples

1/12/2021 1:45 pm

  • date_time_format

Date Time Format

This controls how the last modified date datetime object is formatted as a string when it is passed to the RESTlet.

This value is is eventually used as an argument to Python’s datetime.strftime() function. All strftime formatting options can be used with the exception of %m and %d. The prohibition of %m and %d is due to NetSuite’s lack of support for leading zeros in month and day strings. Because strftime format options produce leading zeros for month and day, the plugin provides two special format templates that do not produce leading zeros: {month} and {day}. These templates should be used instead of %m and %d, respectively.

NOTE: The default value matches the default setting in NetSuite’s preferences. If preferences in an account have been changed, a value for date_time_format must be provided for this parameter.

type

string

pattern

^((?!(%m|%d)).)*$

default

{month}/{day}/%Y %-I:%M %p

  • batch_size

Batch Size

Number of records to include in a single response from the RESTlet. The default value is expected to always result in successful RESTlet invocations. Saved searches returning modest amounts of data may see performance improvements for larger values (e.g., 5000), though larger values have an increased risk of exhausting resources within NetSuite, resulting in errors. The RESTlet rounds this value down to the nearest 1,000.

type

integer

maximum

50000

minimum

1000

default

1000

  • batches_max

Batches Max

The saved search RESTlet will be invoked no more than batches_max times. This can be used to limit the amount of data returned by the job; intended for use in debugging and testing.

type

integer

exclusiveMinimum

0

default

Infinity

  • row_internal_id

Row Internal Id

The saved search will be filtered so as to return only records with internal ids equal to or greater than this value.

type

integer

default

1

  • row_line_id

Row Line Id

Set this to 0 if the saved search results contain a Line Id column.

type

integer

  • restlet_log_level

Restlet Log Level

The NetSuite message type the RESTlet should use when logging messages during execution. This is used to control RESTlet logging without requiring a NetSuite admin to change the log level associated with the RESTlet.

type

string

pattern

DEBUG|AUDIT|ERROR|EMERGENCY

default

DEBUG

additionalProperties

False

  • SavedSearchInput

SavedSearchInput

Defines Saved Search Input

type

object

properties

  • credentials

Credentials

Credentials

anyOf

allOf

BasicCredentials

allOf

TBACredentials

  • restlet

Restlet

Restlet

allOf

Restlet

  • saved_search

Saved Search

SavedSearch

allOf

SavedSearch

  • use

Use

Inputter to be used to get data.

type

string

pattern

^netsuite.io#NetsuiteSavedSearchInput$

additionalProperties

False