Global Variables in Service Catalog

kailashthiyagar
Kilo Guru

How to define Global variables in Service Catalog. What i did was, i declared a variable in the onload script as

var total=0;

and trying to access it in the onChange Script as

alert(total) but its throwing error messages

Could anyone help me with it?

1 REPLY 1

Valor1
Giga Guru

I believe that starting in Helsinki, ServiceNow restricted access to the typical browser-based JS scopes.



You could try the following:


1. Omit the "var":


total = 0; // instead of   var total


2. assign a "document" property:


document.total = 0;


3. Use JQuery to create a custom form element to store your data if the above 2 don't work.