Syntax editor macros

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.

vargr
  • Description: Inserts a standard GlideRecord query for a single value.
  • Output:
    var gr = new GlideRecord("");
                    gr.addQuery("name", "value");
                    gr.query();
                    if (gr.next()) {
                    
                    }
                  
vargror
  • Description: Inserts a GlideRecord query for two values with an OR condition.
  • Output:
    var gr = new GlideRecord('');
                    
                    var qc = gr.addQuery('field', 'value1');
                    
                    qc.addOrCondition('field', 'value2');
                    gr.query();
                    
                    while (gr.next()) {
                    
                    
                    }
                  
for
  • Description: Inserts a standard recursive loop with an array.
  • Output:
    for (var i=0; i< myArray.length; i++) {
     //myArray[i];
     
    }
info
  • Description: Inserts a GlideSystem information message.
  • Output:
    gs.addInfoMessage("");
method
  • Description: Inserts a blank JavaScript function template.
  • Output:
    /*_________________________________________________________________
       * Description:
       * Parameters:
       * Returns:
       ________________________________________________________________*/
       : function() {
       
       },
    
doc
  • Description: Inserts a comment block for describing a function or parameters.
  • Output:
    /**
                    
                    * Description: 
                    
                    * Parameters: 
                    
                    * Returns:
                    */