AI Assistant
Use the AI Command Builder to create and refine slash commands and code snippets with context-aware suggestions.
The AI Assistant helps you create slash commands and code snippets using natural language. Describe what you need, and it generates a complete, ready-to-save result — including the right fields, variables, URL structure, or code.
How It Works
Open the AI side panel from the Manage page (available on both the Commands and Snippets tabs). Type a plain-language description of what you want to build:
- "Create a command that searches incidents by short description and assignment group"
- "Write a GlideAggregate snippet that counts open incidents by category"
- "Make a command that opens the UI Builder page for a given experience"
The AI analyzes your request with context from your ServiceNow environment and generates a complete command or snippet. Review the result, adjust if needed, and save it directly.
Creating Commands with AI
When building a slash command, the AI generates:
- Command name — A short, descriptive name (max 5 characters)
- URL — With the right table, query parameters, and variables
- Hint — A description shown when browsing commands
- Fields — The fields to display in inline results
- Overwrite URL — If the command should open a different page than the list
You can refine the result by providing follow-up instructions, like "add a scope switch" or "include the assignment group in the fields".
Creating Snippets with AI
When building a code snippet, the AI generates:
- Name — A descriptive name for search
- Prefix — A shorthand trigger for quick access
- Category — Script, Client, Server, or Other
- Context — Where the snippet should appear
- Code — Working code with descriptive placeholders
The generated code follows ServiceNow best practices and uses the appropriate API for your chosen context (client-side or server-side).
Tips
- Be specific — The more detail you provide, the better the result. Mention table names, field names, and the behavior you expect.
- Iterate — Use follow-up messages to refine the generated result without starting over.
- Review before saving — Always check the generated code or URL to make sure it matches your intent.
Related
- Custom Commands — Create commands manually
- Creating Snippets — Create snippets manually
- Variables & Helper Methods — URL variables for commands