Inserting javascript into a field via code without executing the code

Jonas27
Kilo Guru

I want to create a Catalog Item variable via code and in the "default_value" field, there should be the following code:

Jonas27_0-1741099962865.png

 

 


But when I create the Catalog Item variable by code in a UI Policy like this:

 

Jonas27_1-1741100013552.png

 then the "default_value" does not contain

Jonas27_2-1741100039938.png

 

and instead it contains the sys_id of the logged in user.

So is there a way to insert javascript code into the default_value field via code without the code being executed?
10 REPLIES 10

@Jonas27 

it did work for me when I ran this yesterday and inserted with the exact thing which you wanted

 

AnkurBawiskar_1-1741173957644.png

 

AnkurBawiskar_0-1741173923513.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader