---
sourceDocument: Xanadu Build or modify applications
sourceDocumentLink: https://www.servicenow.com/docs/r/xanadu/application-development

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu Build or modify applications

ft:clusterId :

    - cadev

bundleId :

    - cadev

workflow :

    - Development, Data, and Analytics


---

# Syntax editor macros

# Syntax editor macros {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](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 or modify a script macro](https://www.servicenow.com/docs/Nzk95uc7lAXWGxOhiYK6HA "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}

