Friday, June 14, 2019

Invalid Search Operator Error caused by Empty Value

When creating a search filter by script, a SSS_INVALID_SRCH_OPERATOR error can be encountered even though the used operator is valid:

Notice (SuiteScript)

An nlobjSearchFilter contains an invalid operator, or is not in proper syntax: {1}.

A possible reason for this occurrence is that the value provided is empty. For example when performing a search on item fulfillments and defining the following search filter:
	var fulfillmentId= '';	var filters = new Array();	filters[0] = new nlobjSearchFilter('internalid', null, 'is', fulfillmentId);	var search = nlapiSearchRecord('itemfulfillment', null, filters);
This can happen when the search is performed in the beforeSubmit event of an User Event script and the fulfillmentId is initialed dynamically by means of nlapiGetRecordId(). When the code is executed for a new record, the record id is not yet available in the beforeSubmit event.

In order to avoid this error a check can be performed to ensure that the provided value is not empty.

No comments:

Post a Comment