'SuiteScript 2.0 Saved Search for Sales Orders with filters on Sublist (item) field

I've created a map/reduce script and in getInputData() I am trying to create a saved search for Sales Orders (transactions), but only once so that I do not have particulars filed on the items populated. Item is a sublist and when I include it in my filter: ['mainline', search.Opertator.IS, 'T'] I do not have access to sublist: Item fields; At the moment my search looks like this:

mySearch = search.create({
           type : search.Type.SALES_ORDER,
           columns : ['otherrefnum'],
           filters:  [
                       ['mainline', search.Operator.IS, 'T']
                      ,'AND'
                      ,['enddate', search.Operator.ONORAFTER, '12/31/2017']
                     ]
            });

At the moment, I am only getting the 'otherrefnum' column which comes from the body of the Sales Order.

Is there a way of including columns from the Item sublist and add a filter from the Item Sublist?

Thank you for all suggestions. Kris



Solution 1:[1]

This is exactly how mainline = 'T' works, it only returns the main record, not items in the sublist. To access the items, you should use mainline = 'F' instead

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitry Masanov