Contents
It Is Possible to Use GenAI in Your Code Development Today, at No Cost
You don’t need to pay for a premium version of GenAI to enjoy its productivity benefits in ServiceNow® code development. Platforms like GitHub Copilot and other open-source resources provide robust, no-cost access to AI-powered coding assistants that can aid in everything from generating code to troubleshooting. These tools can be set up easily and used to enhance your productivity today.
In This Blog, I Will Show You How to Use Various Tools to Make This a Reality
In this post, I’ll walk you through the tools and steps necessary to start leveraging GenAI for ServiceNow code development—without paying a cent. I’ll guide you through the GitHub Copilot integration with VSCode, how to configure the ServiceNow® extension for VSCode, and how to get started on your instance. By the end, you’ll be able to use GenAI as a powerful coding assistant in your daily SN development tasks.

Prerequisites
Before diving into using GenAI for ServiceNow® code development, there are a few prerequisites you need to set up.
GitHub Copilot Subscription (Free)
GitHub Copilot provides an AI-powered code assistant that can help you generate code faster. While GitHub Copilot has paid tiers, it also offers a free version for personal and educational use. You’ll need to sign up for a free account on GitHub and enable Copilot in your development environment.
VSCode
Visual Studio Code (VSCode) is an open-source code editor that will be your primary environment for coding, which is freely available. Additionally, ensure that you install the following extensions:
- GitHub Copilot Chat: This will allow you to interact with Copilot directly within VSCode.
- ServiceNow® Extension for VSCode: This extension offers tools specifically designed for SN development.
ServiceNow Instance
To get started with SN development, you’ll need access to a ServiceNow® instance. This will serve as your environment for deploying and testing your SN code. I would recommend trying this first on a Personal Developer Instance (PDI), which can be requested from https://developer.servicenow.com/. Once you are setup, take note of the following:
- Admin Account & Credentials (Basic or OAuth): You’ll need admin privileges or API credentials to authenticate and access your instance.
- Application (Scoped or Global): You can either create a scoped application or use an existing global one for your development.
GitHub Copilot Key Features
GitHub Copilot is a powerful AI-driven tool that integrates seamlessly into VSCode and aids you in writing code more efficiently. Here are its key features:
Edit Code Across Multiple Files
GitHub Copilot can suggest and help modify code across multiple files simultaneously, allowing you to maintain consistency throughout your project. This feature makes it easier to implement global changes without manually navigating through each file.
Smart Code Suggestions for ServiceNow Patterns
GitHub Copilot’s AI-powered suggestions understand ServiceNow-specific patterns, such as scripting best practices, REST APIs, and business rules. It can recommend ServiceNow-specific code snippets that save time and reduce human error.
Rapid Snippet Generation
Copilot excels in generating code snippets in an instant. Whether you’re working with client scripts, business rules, or UI actions, Copilot can quickly provide usable code to get your development process moving faster.
Supports Multiple Models
GitHub Copilot supports multiple AI models, allowing it to adapt to various coding styles and languages. Whether you’re working with JavaScript, Java, or ServiceNow-specific scripting languages like GlideScript, Copilot has you covered.
Enhanced Productivity in VSCode Extensions
When paired with the right extensions, like the ServiceNow extension for VSCode, GitHub Copilot enhances productivity significantly by reducing the manual effort involved in coding and offering real-time suggestions.
ServiceNow® Extension for VSCode Key Features
The ServiceNow® Extension for VSCode adds specialized functionality for ServiceNow development, enhancing the coding environment for developers working with the platform.
Comprehensive Development Support
The extension integrates essential ServiceNow® development tools right into VSCode, making it easier to create, test, and deploy SN applications. It provides intelligent code completion, error checking, and even deployment tools for an improved development experience.
Rich Editing and IntelliSense
The IntelliSense feature enables auto-completion of ServiceNow scripts, which helps developers avoid errors and speeds up the coding process. Rich syntax highlighting for GlideScript and other ServiceNow languages is also included.
Seamless Synchronization and File Management
One of the key features of the ServiceNow® extension is its ability to sync your local development environment with your ServiceNow instance. This ensures that your files are always up to date, reducing manual error and speeding up the development process.
Integrated Instance Tools
This extension provides direct access to your ServiceNow instance’s instance tools, such as API Explorer and Update Sets, directly within VSCode. This integration streamlines the workflow and ensures that developers can access all necessary tools from one interface.
Flexible Authentication and Customization
The extension allows flexible authentication methods, including OAuth and basic authentication. Additionally, it offers customization options for development preferences, making it adaptable to various user needs and workflows.
Before You Begin
Before diving into GenAI-powered development, it’s important to keep a few limitations and constraints in mind.
Copilot
- Only for Code Modification: Copilot is best suited for modifying and enhancing existing code rather than creating entire applications from scratch. You’ll still need to provide the initial structure and logic for your code.
- Not Context-Aware: Copilot may struggle with understanding your project’s broader context. While it’s great for individual code suggestions, be mindful of potential issues when dealing with complex integrations or business logic.
Models
- Code Edit Only Supports Specific Models: Copilot and other GenAI tools may only support certain models that are optimized for code editing. Advanced features or fine-tuned models may require a paid tier.
- ChatGPT Hallucinates SN Code… A Lot: While ChatGPT can help with code generation, it sometimes produces inaccurate or overly generic suggestions for ServiceNow-specific tasks. Always double-check the code!
VSCode
- Cannot Work in ‘Global’: The ServiceNow® extension for VSCode works only in scoped applications. You cannot use it with global applications without additional setup.
- Be Mindful of Your Customer’s GenAI Policy: Ensure that you’re compliant with any corporate or customer policies regarding the use of GenAI tools in your development process.
Getting Started
Follow these simple steps to begin using GenAI in your ServiceNow® development.
Install VS Code and the Prerequisite Plugins
Start by installing VSCode from the official website. Then, install the required extensions:
- GitHub Copilot Chat
- ServiceNow® Extension for VSCode
Sign in to GitHub Copilot Using Your Account
Log into GitHub Copilot using your GitHub credentials. Make sure you’ve set up the free version, or you have access to the service if you’re eligible.
Create a Now Workspace and a New Project
In VSCode, create a new ServiceNow Workspace and define your project. You can use the ServiceNow® Extension to create the necessary files and structure.
Connect to Your Instance and Select the Application You Wish to Edit
Next, authenticate with your ServiceNow instance using your admin credentials and select the application (scoped or global) that you want to edit. All your scripts will be imported into VSCode and categorised as shown below:

Use GitHub Co-Pilot to Update Your Scripts
With the tools now set up, start using GitHub Copilot to generate code snippets for your ServiceNow development tasks. These can be directly inserted into your existing script using Copilot edits. In the example below, I’ve used the #selection command to select the scope in which code changes can be made, along with my prompt to refactor the code.

Accept or Discard changes as required:

Copilot will also offer intelligent suggestions based on your project context.
Select Sync Project/Sync File to Update Files in Your Instance
After making changes, use the Sync Project/Sync File option at the bottom left of the window in the ServiceNow® Extension for VSCode to push your changes to your ServiceNow instance.

Why not use NowAssist?
Code generation is only a small part of the suite of capabilities available in ServiceNow’s GenAI offering ‘NowAssist’, which may be worth spending the money on depending on the goals of your business. When compared to the broad spectrum of capabilities offered, Code Generation is not the flagship or leading reason to upgrade to use NowAssist. There may even be benefits of using both.
Capability | NowAssist | CoPilot + VSCode |
SN specific models | ✅ | ❌ |
Code Generation / Edit | ✅ | ✅ |
Code Prediction | ❌ | ✅ |
Summarisation | ✅ | ❌ |
SN-specific models | ✅ | ❌ |
Non-code Generation | ✅ | ❌ |
Create Custom SN Skills | ✅ | ❌ |
AI Agents | ✅ | ❌ |
Key Learnings
Code Edit Saves a Lot of Time
Using GenAI tools like GitHub Copilot can drastically reduce development time by automating repetitive coding tasks and generating code suggestions instantly. No more copy and pasting from ChatGPT!
Many Iterations Are Required to Get the Code You Want
Even though GenAI tools are powerful, they often require multiple iterations to get the exact code you need. It’s essential to fine-tune suggestions and ensure they meet your specific requirements.
ServiceNow-Specific Prompt Engineering Is Required
To get the best results from GenAI, you’ll need to customize your prompts based on ServiceNow-specific needs. This requires understanding both the tools and the platform’s scripting patterns.
The best model to use is up for debate
Based on my very scientific LInkedIn survey, GPT-based models are perceived to perform better when generating ServiceNow-specific code, especially when given the proper context and prompts. This may be subject to availability bias, as some other developers have told me they experience better technical responses with Claude. Play around with the different models and see what works for you.
