---
sourceDocument: Australia API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/api-reference

 Release :

    - australia

ft:locale :

    - en-US

ft:publication_title :

    - Australia API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Script macros

# JavaScript syntax editor macros {#ariaid-title1}

Release version: Australia  
Updated March 12, 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read  
Script macros provide shortcuts for typing commonly used code. To insert macro text into a script field, enter the macro keyword followed by the Tab.
Syntax editor macros are defined in the Editor Macros \[syntax_editor_macro\] table. To create or modify a script macro, see [Create a script macro for the syntax editor](https://servicenow-prod.fluidtopics.net/8tJfslWxCBD09hh4NBoLpw "Administrators can define new script macros or modify existing script macros.").

vargr
:
    * Inserts a standard GlideRecord query for a single value.
    * Output:

          var gr = new GlideRecord("$0");
          gr.addQuery("name", "value");
          gr.query();
          if (gr.next()) {
             
          }

    {#r_SyntaxEditorMacros__ul_jqr_ntc_yw}

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

          var gr = new GlideRecord('$0');
           
          var qc = gr.addQuery('field', 'value1');
           
          qc.addOrCondition('field', 'value2');
          gr.query();
           
          while (gr.next()) {

           
          }

    {#r_SyntaxEditorMacros__ul_yf2_rtc_yw}

for
:
    * Inserts a standard recursive loop with an array.
    * Output:

          for (var i=0; i< myArray.length; i++) {
           //myArray[i];

          }

    {#r_SyntaxEditorMacros__ul_w53_stc_yw}

info
:
    * Inserts a GlideSystem information message.
    * Output:

          gs.addInfoMessage("");

    {#r_SyntaxEditorMacros__ul_ixk_vtc_yw}

method
:
    * Inserts a blank JavaScript function template.
    * Output:

          /*_________________________________________________________________
          * Description:
          * Parameters:
          * Returns:
          ________________________________________________________________*/
          : function() {

          },

    {#r_SyntaxEditorMacros__ul_r1j_xtc_yw}

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

          /**
          * Description:
          * Parameters:
          * Returns:
          */

    {#r_SyntaxEditorMacros__ul_udd_ztc_yw}

