Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Service Now Code Snippets for VS Code

johansec
Tera Guru

Hey Guys,

I am new to service now scripting and want to make it easier. I created snippets based off of service now documentation. I use VS Code (Its Free!) to write my scripts.

To set up

  1. Download Visual Studio Code - Code Editing. Redefined
  2. Download and open the snippets file attached to this.
  3. Copy the contents.
  4. Open VS Code
  5. Navigate to File > Preferences > User Snippets
  6. Select Javascript from the dropdown
  7. Paste this over current (Unless you have existing snippets you created).
  8. Test in a new javascript file.

About This file

  • All snippets prefixed with sn_
  • Separated in main categories
    • sn_query - Basic Queries
    • sn_delete - Delete records
    • sn_insert - Insert New records
    • sn_addquery - Additional snippets to add query filters
    • sn_alert - Different alerts for client and server side scripts
    • sn_user - client and server snippets for the user object
    • sn_form - snippets for the g_form object
  • Easy to change any names by changing the prefix within the file.

Screenshot

find_real_file.png

This may not be perfect but can be a good place to start. Hope this helps someone.

5 REPLIES 5

This is no longer listed in the store