How to resolve SuiteScript Error SSS_INVALID_SRCH_OPERATOR

Scenario

If an nlobjSearchFilter contains an invalid operator, or is not in proper syntax: {1}, an error is thrown: SSS_INVALID_SRCH_OPERATOR 

Solution

The error may be thrown by any of the following scenarios:

The filter name is not officially supported, i.e., the filter is not officially documented in the SuiteScript Records Browser under the record type being searched. 

// ERROR: The filter ‘name’ is not an official search filter for the ‘salesrecord’ record type 

// nlobjSearchFilter example 

var f = new nlobjSearchFilter(‘name’, null, ‘startswith’, ‘Item #1’); 

// filter expression example 

var f = [‘name’, ‘startswith’, ‘Item #1’]; 

var s = nlapiSearchRecord(‘salesorder’, null, f);

The operator used in the filter does not match the field type of the filter. 

//ERROR: The operator ‘within’ is not valid for Text-type fieldset 

//nlobjSearchFilter example 

var f = new nlobjSearchFilter(‘name’, null, ‘within’, ‘Item #1’); 

//filter expression example 

var f = [‘entity’, ‘within’, ‘Item #1’]; 

var s = nlapiSearchRecord(‘salesorder’, null, f);

To help avoid this error, follow these steps:

Open the SuiteScript Records Browser.

Navigate to the record type being searched.

Locate the Search Filters table and verify whether the filter is listed.

Check the list of Search Operators within the Help Guide to see whether the search operator used within the filter matches the type of the specified field.

Disclaimer

The sample code described herein is provided on an “as is” basis, without warranty of any kind, to the fullest extent permitted by law. Oracle + NetSuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.

Leave a comment

Your email address will not be published. Required fields are marked *