RE: Filtering on checkbox not working properly?

Hi, to try and make this short, I’m able to pull Expense Reports and filter with a custom checkbox no problem with the following code:

var myFilter = search.createFilter({

name: 'cust_sent_checkbox',

operator: search.Operator.IS,

values: ['false']

});
var results = search.create({

"type": search.Type.EXPENSE_REPORT,

"filters": [myFilter]

});

results = results.run();
return results.getRange(0, 1000);

Absolutely no problem with this. It returns all the Expense Report with the correct filter.
But, if i try with a standard checkbox like ‘Accounting Approval’ like this;

var myFilter = search.createFilter({

name: 'accountingapproval',

operator: search.Operator.IS,

values: ['false']

});
var results = search.create({

"type": search.Type.EXPENSE_REPORT,

"filters": [myFilter]

});

results = results.run();
return results.getRange(0, 1000);

Yet, I get the following error:


{

"errors": {},

"status": false,

"catch": {

"type": "error.SuiteScriptError",

"name": "SSS_INVALID_SRCH_FILTER",

"message": "An nlobjSearchFilter contains invalid search criteria: accountingapproval.",

"stack": [

"getRange(N/searchObject)",

"searchExpenseReport(/SuiteScripts/ExpenseReports.js:170)",

"onGet(/SuiteScripts/ExpenseReports.js:71)"

],

"cause": {

"type": "internal error",

"code": "SSS_INVALID_SRCH_FILTER",

"details": "An nlobjSearchFilter contains invalid search criteria: accountingapproval.",

"userEvent": null,

"stackTrace": [

"getRange(N/searchObject)",

"searchExpenseReport(/SuiteScripts/ExpenseReports.js:170)",

"onGet(/SuiteScripts/ExpenseReports.js:71)"

],

"notifyOff": false

},

"id": "",

"notifyOff": false,

"userFacing": false

}

}

Now based on NetSuite documentation here, accountingapproval is the correct internalID.

https://www.netsuite.com/help/helpcenter/en_US/srbrowser/Browser2018_1/script/record/expensereport.html

So, does anyone know what is it that I’m doing wrong?
Thanks!

cprevost Rookie Asked on October 8, 2020 in SuiteScript.
Add Comment
1 Answers

I’ve only ever seen checkboxes filters with [`checkboxid’, ‘is’, ‘F’], perhaps try using ‘F’ or ‘T’ instead of true or false.  Alternatively, make the search in the UI and use the chrome extension export saved search tool.

Intermediate Answered on October 8, 2020.

I really wish it was that simple. I tried all the possible values, true, false, T, F, quote or unquote, doesn’t make a difference, the problem remains the same.

on October 8, 2020.

I double down on the make the search in the ui, If you cant find accounting approval in the list of filters, its unlikely to be a filter you can add.

on October 8, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.