I'm trying to get all of the items associated with a purchase order. I've created the saved search in the UI, but I need to pass the PO's internal ID to get the correct list of items. I tried doing this in suitescript, but I can't find the correct join table for Item? Looking at the record browser, I couldn't find item. Is this not possible?
var poItemSearch = search.create({
type: 'transaction',
filters : [
search.createFilter({
name : 'type',
operator : search.Operator.IS,
values : 'Purchase Order'
}),
search.createFilter({
name : 'internalid',
operator : search.Operator.ANYOF,
values : poID
}),
search.createFilter({
name : 'item',
join : 'item',
operator : search.Operator.IS,
values : 'Inventory Item'
})
],
columns: [
search.createColumn({name : 'item'})
//search.createColumn({name : 'email', join : 'custrecord_sdr_prod_pref_customer'}),
//search.createColumn({name : 'subsidiary', join: 'custrecord_sdr_prod_pref_customer'}),
//search.createColumn({name : 'custrecord_sdr_prod_pref_item'}),
//search.createColumn({name : 'custrecord_sdr_prod_pref_qty'}),
//search.createColumn({name : 'quantityavailable', join: 'custrecord_sdr_prod_pref_item'})
]
});
I get an error that Item is not an option for a join. Am I just using the wrong name?
Otherwise, how do I add a filter to an existing saved search? I can go about it this way to just filter my search results on the purchase order internal id.