Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How can I define a Custom Global Variable?

G24
Kilo Sage

Hello.  I am aware of the magical ServiceNow global objects such as:

  gs - Available in Server Side code.

  g_form - Available in Client Side code.

 

My question is this:  Can I define and instantiate my own custom global variable which is also uber available and does not require instantiation by every piece of code which wants to make use of it?

 

I know that there are Classless Functions which work this way on the Server Side, but I'd kind of like for them to live inside an object, as opposed to floating around independently.  That way, I could simply type the name of my global object and then a DOT, and I would immediately see all of my magical functions which are available.

 

Make sense?  Please advise.  Thank you.

5 REPLIES 5

@CatQT I'm sure you're right.  But as a former .NET developer, I get very frustrated that every time I try to do something in ServiceNow, I feel Blocked by the guardrails.  Isn't this supposed to be a Software Development Platform???

 

(Sometimes it feels like a Software Development Prison cell.)