Jacob D
07/28/2021, 7:52 PMvar itemSearchObject = search.create({
type: 'item',
filters: [
['custitem_associated_item.isonline','is','T'],
'AND',
['custitem_associated_item.isinactive','is','F'],
'AND',
['custitem_associated_item.custitem_closeoutitem','is','T'],
'AND',
['inventorylocation.makeinventoryavailablestore','is','T'],
'AND',
['inventorylocation.isinactive','is','F']
],
columns: [
search.createColumn({
name: 'type'
}),
search.createColumn({
name: 'parent',
join: 'CUSTITEM_ASSOCIATED_ITEM',
summary: 'GROUP',
label: 'Parent'
}),
search.createColumn({
name: 'locationquantityavailable',
summary: 'SUM',
label: 'Location Available'
})
]
});
itemSearchObject.run().each(function(result){
// do stuff
return true;
});
I’m not very experienced with joins and functions within search results, but any time I add the column for the item type, things go haywire and I just get an UNEXPECTED_ERROR
. Any idea as to what would be the problem here?CD
07/28/2021, 7:53 PMJacob D
07/28/2021, 7:55 PMCD
07/28/2021, 7:56 PMJacob D
07/28/2021, 8:00 PMparent
and locationquantityavailable
Jacob D
07/28/2021, 8:04 PMSandii
07/28/2021, 8:05 PMparent
and grab type
insteadJacob D
07/28/2021, 8:07 PMparent
and type
?Sandii
07/28/2021, 8:08 PMN/query
since its a double level join.Jacob D
07/28/2021, 8:10 PMN/query
. Crap…Sandii
07/28/2021, 8:13 PMassociated item
, the type of the associate item would be (assuming its an item record)
search.createColumn({
name: 'type',
join: 'CUSTITEM_ASSOCIATED_ITEM',
summary: 'GROUP',
label: 'Parent'
})
currently you are grabbing the parent of the associated itemJacob D
07/28/2021, 9:32 PMSandii
07/28/2021, 9:33 PMSandii
07/28/2021, 9:35 PM