Resolve Error: “SSS_INVALID_SRCH_OPERATOR” on RESTlet

Scenario: User has a RESTlet script that is getting the value of the dynamic filter from the request parameter. However, user is getting an error: “SSS_INVALID_SRCH_OPERATOR”. When the script operator parameter value is hard-coded, error is not reproducible. Solution: The reason why the error: “SSS_INVALID_SRCH_OPERATOR” is encountered when using script parameters as search operator is… Continue reading Resolve Error: “SSS_INVALID_SRCH_OPERATOR” on RESTlet

To search for child customers under a parent customer for unlimited levels in NetSuite using a Saved Search

To search for child customers under a parent customer for unlimited levels in NetSuite using a Saved Search, you can still use the Parent (Hierarchy) field, which is designed to search across all levels of hierarchy without needing to manually define the number of levels. Here’s how to create a Saved Search to retrieve all… Continue reading To search for child customers under a parent customer for unlimited levels in NetSuite using a Saved Search

Line Filters in SuiteScript

In addition to mainline there are several sublist line filters. Main Line Shipping Line Tax Line COGS Line Here is what that same filter setup looks like in SuiteScript: s.create({ type: s.Type.SALES_ORDER, filters: [ [‘mainline’, s.Operator.IS, false], ‘and’, [‘taxline’, s.Operator.IS, false], ‘and’, [‘shipping’, s.Operator.IS, false], ‘and’, [‘cogs’, s.Operator.IS, false] ] }).runPaged().count This Search will provide one result… Continue reading Line Filters in SuiteScript

How do we script to be able to more than 4000 rows using the forEachResult() method?

To overcome this limitation you can: Use Search.run().getRange() to iterate the full result set by range, and then iterate the results contained in each range. Use Search.runPaged(), fetch the data for each page and iterate the results. Example: var searchObj = searchObjSearch.runPaged({ pageSize:1000 }); searchObj.pageRanges.forEach(function (pageRange) { searchObj.fetch({ index:pageRange.index }) .data.forEach(function (result) { //Process each search result here }); csv.push(row);… Continue reading How do we script to be able to more than 4000 rows using the forEachResult() method?

Exclude Opportunities created from an Estimate in Saved Search

Companies exclude opportunities created from estimates in their reports as they may want to keep a clear distinction between different stages of the sales process. Some companies may also want data accuracy. It helps in creating more precise reports by filtering out the opportunities that are not primary leads but rather repeat buyers. Using NetSuite,… Continue reading Exclude Opportunities created from an Estimate in Saved Search

Concatenate 3 fields on the results of a Saved Search

To concatenate 3 fields on the results of a saved search, do the following: Create a saved search, List > Search > Saved Searches > New. You may select any search type, for this example select Customer. Navigate to the Results tab and add the field “Formula (Text)” and enter the following as the value of the Formula: Concat({firstname},… Continue reading Concatenate 3 fields on the results of a Saved Search

Fetching Search Results with SOAP Requests in NetSuite

NetSuite’s SOAP-based web services allow for advanced searches, including searching for records by their internal IDs. This article will guide you through constructing SOAP requests to fetch search results by internal ID, with examples. To fetch data, construct a SOAP request specifying the criteria and columns you want to search for. Below is an example… Continue reading Fetching Search Results with SOAP Requests in NetSuite

How to get a unique values from a search without using mainline in a transaction

function getItemFulfillments(salesOrderId, itemIds) {       let itemfulfillmentSearchObj = search.create({         type: “itemfulfillment”,         settings:[{“name”:“consolidationtype”,“value”:“ACCTTYPE”}],         filters:         [           [“type”,“anyof”,“ItemShip”],           “AND”,           [“createdfrom”,“anyof”,salesOrderId],           “AND”,           [“item”,“anyof”,itemIds]         ],         columns:         [           search.createColumn({            name: “internalid”,            summary: “GROUP”,            label: “Internal ID”           })         ]        });        let searchResultCount = itemfulfillmentSearchObj.runPaged().count;        log.debug(“result count”, searchResultCount);        let ifArray = [];        if (searchResultCount > 0) {         itemfulfillmentSearchObj.run().each(function (result) {            ifArray.push( result.getValue({ name: “internalid”,             summary:… Continue reading How to get a unique values from a search without using mainline in a transaction