{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":672,"path":"api-reference/scripts/r_SyntaxEditorMacros.md","title":"JavaScript syntax editor macros","bundle":null,"doc_type":null,"release":"australia","body":"\n# JavaScript syntax editor macros\n\nScript macros provide shortcuts for typing commonly used code. To insert macro text into a script field, enter the macro keyword followed by the Tab.\n\nSyntax 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://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/scripts/t_ManageScriptMacros.md).\n\n-   **vargr**\n    -   Inserts a standard GlideRecord query for a single value.\n    -   Output:\n\n        ```javascript\n        var gr = new GlideRecord(\"$0\");\n        gr.addQuery(\"name\", \"value\");\n        gr.query();\n        if (gr.next()) {\n           \n        }\n        ```\n\n-   **vargror**\n    -   Inserts a GlideRecord query for two values with an `OR` condition.\n    -   Output:\n\n        ```javascript\n        var gr = new GlideRecord('$0');\n         \n        var qc = gr.addQuery('field', 'value1');\n         \n        qc.addOrCondition('field', 'value2');\n        gr.query();\n         \n        while (gr.next()) {\n        \n         \n        }\n        ```\n\n-   **for**\n    -   Inserts a standard recursive loop with an array.\n    -   Output:\n\n        ```javascript\n        for (var i=0; i< myArray.length; i++) {\n         //myArray[i];\n        \n        }\n        ```\n\n-   **info**\n    -   Inserts a GlideSystem information message.\n    -   Output:\n\n        ```javascript\n        gs.addInfoMessage(\"\");\n        ```\n\n-   **method**\n    -   Inserts a blank JavaScript function template.\n    -   Output:\n\n        ```javascript\n        /*_________________________________________________________________\n           * Description:\n           * Parameters:\n           * Returns:\n           ________________________________________________________________*/\n        : function() {\n        \n        },\n        ```\n\n-   **doc**\n    -   Inserts a comment block for describing a function or parameters.\n    -   Output:\n\n        ```javascript\n        /**\n                        \n         * Description: \n                        \n         * Parameters: \n                        \n         * Returns:\n        */\n        ```\n\n\n**Parent Topic:**[Using the JavaScript syntax editor](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/scripts/r_EdtJvaScptWSyntxEdtr.md)\n\n"}}