As you probably have noticed, much of the code that you write is repeatable and are the same repeatedly in different places.

Now these macros are here to make your life a lot easier. There are a few OOB, and you can easily add your own. Just remember that the macros you create isn’t personal, everyone on the instance who have credentials to edit a script editor, will be able to use the macros.

What do they do?

If we look at the OOB ones there is for example a macro called “vargr”.

f you type vargr and press “TAB” in a script editor this will replace “vargr” with the code that is inside the field “text” in the macro record.

For this example it will put:

var gr = new GlideRecord(“”);

gr.addQuery(“name”, “value”);


if ( {


Other OOB available macros:

vargror: Inserts a GlideRecord query for two values with an OR condition.

for: Inserts a standard recursive loop with an array.

info: Inserts a GlideSystem information message.

method: Inserts a blank JavaScript function template.

doc: Inserts a comment block for describing a function or parameters.