Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

Setting value to Boolean field using GlideRecord

RahulY00040
Tera Contributor

Hello friends,


When i try to do below, it fails (does nothing) with string "True" whereas works well with string "False". I tried with string "true" and it worked, but want to check, why it wouldnt work with string "True".

 

var gr=new GlideRecord('cmdb_ci_computer');
gr.get('xxxxx');
//gr.setValue('virtual',"False");
gr.setValue('virtual',"True"); //Virtual is the BOOLEAN field.
gr.update();

 

Thanks in advance,

Rahul

1 REPLY 1

Brad Bowman
Mega Patron

Boolean values are true and false or "true" and "false".  I would submit that the script does not work well with "False", rather it's not setting a value the same as "True" is not setting a value, so the result in both cases is an empty checkbox/false value since a boolean has to be either true or false.