Syntax editor macros

  • 릴리스 버전: Australia
  • 업데이트 날짜 2026년 03월 12일
  • 소요 시간: 2분
  • 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.

    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()) {
         
      }
    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()) {
      
       
      }
    for
    • Inserts a standard recursive loop with an array.
    • Output:
      for (var i=0; i< myArray.length; i++) {
       //myArray[i];
      
      }
    info
    • Inserts a GlideSystem information message.
    • Output:
      gs.addInfoMessage("");
    method
    • Inserts a blank JavaScript function template.
    • Output:
      /*_________________________________________________________________
         * Description:
         * Parameters:
         * Returns:
         ________________________________________________________________*/
      : function() {
      
      },
    doc
    • Inserts a comment block for describing a function or parameters.
    • Output:
      /**
                      
       * Description: 
                      
       * Parameters: 
                      
       * Returns:
      */