logo

NJP

Visual Studio Code (ServiceNow Syntax Macros)

Import · Feb 14, 2017 · article

Basically this is extension of treycarroll work done in Visual Studio Code Snippets for common ServiceNow Syntax Macros I have create snippets for Visual Studio Code.

Download javascript.json file and put it:

  • Windows %APPDATA%\Code\User\snippets\javascript.json
  • Mac $HOME/Library/Application Support/Code/User/snippets/javascript.json
  • Linux $HOME/.config/Code/User/snippets/javascript.json

Example of snippet description:

{

  "Insert GlideRecord": {

  "prefix": "grins",

  "body": [

  "var gr = new GlideRecord('${1:TableName}');",

  "gr.Initialize();",

  "gr.${2:UpdateColumnName} = '${3:UpdateColumnValue}';",

  "gr.insert();"

  ],

  "description": "Template for inserting a GlideRecord record."

  }

}

Start your Visual Studio Code and if you create JavaScript file you should be able to use these macros.

image

When template generate use Tab to jump to the next editable area:

image

Feel free to update macros but don't forget to share it

View original source

https://www.servicenow.com/community/developer-articles/visual-studio-code-servicenow-syntax-macros/ta-p/2330462