I’m running into unclear error, anyone able to hel...
# suitescript
g
I’m running into unclear error, anyone able to help?
Copy code
let ss = search.create({
        type: search.Type.ITEM,
        columns: ['internalid', 'itemid', 'custitem_date_qbp_inv_change', 'lastquantityavailablechange','islotitem'],

        filters: [
                ['isonline', 'is', 'T'],
                'AND',
                ['custitem_syncto', 'is', 'T'],
                'AND',
                [
                        [
                                ['custitem_date_inv_change', 'isempty'], 
                                'AND',
                                ['lastquantityavailablechange', 'after', '10/1/2023 11:59 pm']
                        ],
                        'OR',
                        ['FORMULANUMERIC: CASE WHEN {lastquantityavailablechange} >' +
                        ' {custitem_date_inv_change} THEN 0 ELSE 1 END', 'equalto', '0']
                ]
        ]
});
I’m getting “Wrong parameter type: filters is expected as Array.” and I’m not seeing the problem 😞
m
i had issues like this before, make sure your variables that you use in the formula are strings
j
I haven't tested this but could it be the nest array where I assume you are wanting to bracket it? Does this work?
Copy code
let ss = search.create({
  type: search.Type.ITEM,
  columns: [
    "internalid",
    "itemid",
    "custitem_date_qbp_inv_change",
    "lastquantityavailablechange",
    "islotitem",
  ],

  filters: [
    ["isonline", "is", "T"],
    "AND",
    ["custitem_syncto", "is", "T"],
    "AND",
    "(",
    ["custitem_date_inv_change", "isempty"],
    "AND",
    "(",
    ["lastquantityavailablechange", "after", "10/1/2023 11:59 pm"],
    "OR",
    [
      "FORMULANUMERIC: CASE WHEN {lastquantityavailablechange} >" +
        " {custitem_date_inv_change} THEN 0 ELSE 1 END",
      "equalto",
      "0",
    ],
    ")",
    ")",
  ],
});
j
I recommend building your search in the UI and then using the awesome Chrome Extension NetSuite Search Export to look at the code it generates. https://chrome.google.com/webstore/detail/netsuite-search-export/gglbgdfbkaelbjpjkiepdmfaihdokglp
👍 1
c
Try
Copy code
['custitem_date_inv_change', 'isempty', '']
this 1
e
The
isempty
operator still needs a value; I'd expect ^ this to do it
g
Thanks everyone! Got it working with the help!
🎉 1
1