Instead of value is "NULL" it was creating the empty record

balajibs
Tera Contributor

Please find the script below. I am trying to insert the "value" field as a "NULL" string, but it is creating an empty record. Does anyone know why the string is being converted into an empty record?

 

Script:
var gr = new GlideRecord("sn_ti_observable");
gr.initialize();
gr.value = "NULL";
gr.insert();

3 REPLIES 3

amaradiswamy
Kilo Sage

Hi,

 

What is the data type of the field "value"?

Check if the field's backend name is correct or not

Hi Amaradiswamy,

Thanks for your response.

Datatype is "String." I have checked the backend name; also, it's correct.

 

Whenever I tried with gr.value="xyz.com," it was properly updating into the field. But gr.value="NULL," then an empty record is created.

 

Hajar BENJAHHAR
Mega Sage

Hello @balajibs , 

 

Using the string "NULL" as a value is not expected  in ServiceNow. When assignig this value, the fieald is automatically cleared. 

Please consider using a different  word or assign a value like "N U L L" instead.

 

Best regards, 

Hajar