Is it possible to use the search results of one search as the criteria for a new search in NetSuite

StackOverflow https://stackoverflow.com/questions/9133271

  •  22-04-2021
  •  | 
  •  

Question

Using NetSuite is it possible to embed a search within another search? I have a search that I need that will be effectively using another search's results in the criteria.

The basic structure of my search is:

Return all non-inventory skus, starting with a specific prefix,
    Where the occurrence of the previously mentioned skus on a custom field on
    Inventory-Part records is greater than 0.

This is then intended to be used for alerts

I'm not sure how to build this within NetSuite's search builder.

Was it helpful?

Solution

I don't think this pertains to any scripting as m_cheung suggested.

To answer your question, yes this is doable via saved search.

  1. Transaction > Management > Saved Search > New
  2. Select 'Item' from the list
  3. In the criteria section:

    • Type = 'Non-Inventory Items'
    • External ID = starts with (...your desired prefix) (NOTE: Assuming that prefix is the external ID from your question)
    • Select the Custom field and criteria is greater than 0.
    • Save and Run to confirm if this is the desired result.

OTHER TIPS

using nlapiSearchRecord(RECORDTYPE, JOIN_, __SEARCHFILTERSARRAY, __SEARCHCOLUMNSARRAY) you can return the results of a search and pass the returned data further into script logic

for example if you build search1 using a searchFilter array and a searchColumn array then pass these arrays into nlapiSearchRecord('item'), you can assign this call to a variable:

var searchresults = nlapiSearchRecord('item', null, searchFiltersArray, searchColumnsArray);

then using searchresults (which is an nlobjSearchResults object) you can pull out your returned search data for criteria in search2:

if(searchresults)
{
  for(i=0;i<searchresults.length; i++)
  {
    var search2FilterAndColumnData = searchresults[i].getAllColumns();
  }
}

You can use a saved search for creating another search in suitescript. Somewhat like ,

var arrSearchResult = nlapiSearchRecord( null , SAVED_SEARCH_ID , FILTERS , COLUMNS);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top