Hi all,
Working on a large script and at the moment I'm trying to get the serial number of items on the Sales Orders to be used as one of the filters for a search.
I'm not sure how the filters are targeted, pretty sure it's by the field ID, but what would the field id be for the serial number? Can I join through to the correct field? I tried to do item.inventorydetail.issueinventorynumber but that didn't work. Though I'm not sure if that's because it's just wrong or I can't join at all.
I did also look at a sales order in xml (add '&xml=t' to the end of your url) and couldn't see any useful fields to target.
On an actual saved search, I can see item serial numbers using the filter Inventory Detail : Number
Would appreciate a little guidance, thanks!
Below is my search code and some of the alternatives I have tried.
function findAssociatedInvoice(serialNumber) {
var invoiceSearch = search.create({
type: search.Type.SALES_ORDER,
filters: [
['subsidiary', 'anyof', '1'], // Subsidiary id: 1 (MPUK)
'AND',
['entity', 'anyof', '5173'], // Customer id: 5173 (CrossBoundary Energy Access Platform)
'AND',
['serialnumber', 'is', serialNumber] // Serial number of the item sold
],
columns: ['tranid']
});
item.serialnumber ? No
item.inventorydetail.issueinventorynumber ? No
inventorydetail.number ? No
inventorydetail.issueinventorynumber ? No
item.inventorydetail.number ? No