- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 06:35 AM
Hi All,
Sorry if this is super simple but i'm unable to make this work so hoping someone could help.
I'm trying to exclude false or null values when using the record producer.
We have radio buttons that if not selected it returns a value false which then comes into the ticket.
I've been able to get either null values not showing or false not showing but not both.
Script below where you can see my failing script.
var gr_questions = new GlideRecord('item_option_new');
gr_questions.addQuery('sys_id', 'IN', arr_questionSysIds.toString()); //Single call to the table with all variables we are looking for
gr_questions.orderBy('order'); //Order by the order they are on the catalog item form
gr_questions.query();
var description = "";
while (gr_questions.next()) {
var question = gr_questions.getValue('question_text');
var value = producer[gr_questions.getValue('name')].getDisplayValue();
if (value !== "false" && !null)
{ //only get variables with values
description += question + ": " + value + "\n";
}
I've also tried if ((value !== "false") || (value !== null))
any assistance would be greatly appreciated
Cheers as always
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 06:37 AM
Hi @Sam Motley
Try this:
var gr_questions = new GlideRecord('item_option_new');
gr_questions.addQuery('sys_id', 'IN', arr_questionSysIds.toString()); //Single call to the table with all variables we are looking for
gr_questions.orderBy('order'); //Order by the order they are on the catalog item form
gr_questions.query();
var description = "";
while (gr_questions.next()) {
var question = gr_questions.getValue('question_text');
var value = producer[gr_questions.getValue('name')].getDisplayValue();
if (value && value != null && value != '')
{ //only get variables with values
description += question + ": " + value + "\n";
}
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2023 06:41 AM
Hi @Samaksh Wani,
That is not going to work.
if it is "false" it is not null, and if it is null it is not "false". So your OR, will always evaluate to true.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.