ServiceNow Production-Grade Prompt Ideas
The highest education is that which does not merely give us information but makes our life in harmony with all existence.
-Rabindranath Tagore.
This guide offers a collection of production-grade prompt ideas designed to test an AI's ability to generate high-quality, scalable, and maintainable ServiceNow solutions. The prompts are categorized into three key developer personas: the Architect, the DevOps Engineer, and the Quality Assurance specialist.
Section 1: The "Architect" Prompts - Designing for the Future
These prompts focus on foundational design decisions that ensure a ServiceNow instance is secure, scalable, and maintainable from the ground up.
-
Principle: Security & Access Control
Prompt Idea: "I need to secure a new table,
x_my_scope_product_request
, so that users can only see their own requests unless they have thex_my_scope.product_manager
role. Create the necessary Access Control Lists (ACLs) for this requirement, including record-level and field-level security. Provide a breakdown of each ACL and its purpose."ServiceNow Specifics: This prompt challenges the AI to move beyond basic CRUD operations to the core of ServiceNow's security model. A good response will understand
current.isNewRecord()
,gs.getUserID()
, and dot-walking on reference fields to create robust ACLs that are difficult to bypass. -
Principle: Data Governance & Integrity
Prompt Idea: "Our Incident Management process requires that a user's location is automatically populated when they select a new user in the 'caller' field. Design the best method to implement this. Consider the trade-offs between a Client Script with
g_form.getReference()
, agetReference()
callback function, and a Client Script calling a Script Include. Provide the code for the most performant and scalable solution."ServiceNow Specifics: This forces the AI to weigh the trade-offs between server-side and client-side logic. The best answer will likely recommend an
onChange
Client Script that calls a server-side Script Include viaGlideAjax
. This approach prevents the common performance pitfalls of synchronousg_form.getReference()
calls and ensures data consistency across the platform. -
Principle: Platform-Native Integration Best Practices
Prompt Idea: "We need to integrate with an external API to retrieve customer data. The API requires a Bearer token that expires every 15 minutes. Design the ServiceNow solution using IntegrationHub spokes and Connection & Credential Aliases. Provide a detailed flow for token management, including refreshing the token before it expires, and show how the solution adheres to the principle of 'don't reinvent the wheel' by leveraging platform features."
ServiceNow Specifics: This is a fantastic prompt for modern development. It pushes the AI to use platform-native tools (IntegrationHub) and best practices for secure and reliable integrations, rather than writing a custom
RESTMessageV2
script that would be less manageable. -
Principle: Automated Change Management and Risk Assessment
Prompt Idea: "Our organization is implementing a new CI type,
cmdb_ci_app_service_cloud
. Design a Change Management workflow that automatically classifies changes to this CI type as 'Standard' if they meet predefined criteria (e.g., specific attribute changes, pre-approved templates). The workflow must use Flow Designer to trigger a Risk Assessment that calculates the final risk score based on the change type and CI impact, without requiring manual intervention."ServiceNow Specifics: This prompt moves beyond simple records and into core ITSM processes. It requires an understanding of Flow Designer, Change Management, and automated risk assessment. This highlights the power of leveraging platform capabilities to reduce manual effort and minimize human error, which is critical for scaling any ITSM implementation.
-
Principle: Scalable & Maintainable Data Model
Prompt Idea: "We need to track a new custom attribute,
client_server_type
, on all servers in our CMDB. Propose a solution that adheres to CMDB Data Model best practices. Should we extend thecmdb_ci_server
table directly, or create a new related custom table? Justify your choice by discussing the impact on performance, future maintenance, and data integrity. Provide the necessary update set XML or a detailed description of the table and field definitions."ServiceNow Specifics: This is a fundamental architectural decision. The AI's response should demonstrate knowledge of the CMDB hierarchy, the pros and cons of extending a base table versus creating a standalone table, and the importance of avoiding CMDB "bloat." It should advocate for extending the base table only if the attribute is truly a fundamental characteristic of all servers.
Section 2: The "DevOps Engineer" Prompts - Performance & Reliability
For the DevOps-minded engineer, these prompts target the operational health of the platform, focusing on performance, efficiency, and resilience.
-
Principle: Efficient Data Retrieval
Prompt Idea: "I have a complex report that is timing out on a large table. The report's conditions are on a field that is not indexed. Analyze the report definition and suggest a performance optimization strategy. Should we create a new index, or can the query be rewritten to use an existing one? Provide a revised, more efficient
GlideRecord
query for this scenario."ServiceNow Specifics: This addresses a classic ServiceNow performance problem. The AI's answer should discuss the importance of database indexing and demonstrate how to write highly performant
GlideRecord
queries usingaddQuery()
andaddEncodedQuery()
. -
Principle: Resilient Business Rules
Prompt Idea: "Review this 'after' Business Rule. It's designed to update a related table but occasionally fails with a
Maximum execution time exceeded
error. Identify the root cause and propose a refactored solution using a Scheduled Job orgs.eventQueue()
to move the heavy processing to an asynchronous worker thread. Provide both the revised Business Rule and the corresponding Scheduled Job script."ServiceNow Specifics: This prompt is perfect for addressing long-running, synchronous operations. The AI's response should clearly explain why moving the work off-thread is a best practice for maintaining a responsive user experience and ensuring transactional integrity.
-
Principle: Secure & Maintainable Client Scripts
Prompt Idea: "The following
onLoad
Client Script has several hard-coded values and directly usesGlideRecord
to query the database. Refactor this script to eliminate hard-coded values by using a System Property. Additionally, replace theGlideRecord
query with a call to a dedicatedGlideAjax
Script Include, and explain why this is a more secure and efficient method."ServiceNow Specifics: This prompt addresses two major anti-patterns in client-side development. The AI should demonstrate how to properly use
GlideAjax
to perform server-side calls without exposing unnecessary data to the client, making the script more configurable and maintainable. -
Principle: Batch Processing & Scheduled Jobs
Prompt Idea: "I need to process a daily feed of user data from a third-party system containing over 100,000 records. The existing Import Set Transform Map is causing a significant performance impact during business hours. Propose a solution to offload this processing to a non-peak time. Design a Scheduled Job and a new Transform Script that can handle the volume efficiently. The solution must include a mechanism for error handling and logging a summary of processed records."
ServiceNow Specifics: This prompt addresses large-scale data ingestion. It requires an understanding of scheduled jobs, batch processing, and how to write efficient transform scripts. The solution should emphasize breaking the large import into smaller, manageable chunks to prevent system overload.
-
Principle: Asynchronous Scripting with the Scoped Flow API
Prompt Idea: "I am troubleshooting a custom application where a Business Rule triggers a script to perform a lengthy query. The user experience suffers as the UI freezes while waiting for the query to finish. Refactor the code to use the
sn_fd.FlowAPI
to initiate a Flow asynchronously. The new Flow should handle the data processing and update the record when complete, allowing the user to continue working immediately. Provide the refactored Business Rule and a description of the Flow's steps."ServiceNow Specifics: This prompt highlights the importance of asynchronous scripting. It specifically asks for the use of modern APIs like
sn_fd.FlowAPI
over older methods, which is a key indicator of a production-ready solution.
Section 3: The "Quality Assurance" Prompts - Debugging & Troubleshooting
Effective troubleshooting is a critical skill. These prompts are designed to test an AI's ability to diagnose and resolve common, often complex, issues in a ServiceNow environment.
-
Principle: Update Set Sanity & Integrity
Prompt Idea: "Scan the following Update Set for potential issues. Identify any hard-coded
sys_id
dependencies, incomplete records, or objects that should be excluded. Generate a report of potential problems and explain the best practices for managing Update Sets to ensure a smooth promotion to the production instance."ServiceNow Specifics: This is a critical process for any ServiceNow development team. The AI can act as a "linting" tool, identifying common mistakes like hard-coding
sys_id
s from a development instance, which can cause serious problems during deployment. -
Principle: Comprehensive Error Logging & Analysis
Prompt Idea: "Review the following script. It's causing an error in the system logs, but the error message is unhelpful. Add robust
gs.info()
andgs.error()
logging statements to the script to help with future debugging. Specifically, log the values of key variables at different stages of the script's execution. Provide the updated, well-commented script."ServiceNow Specifics: Effective logging is the first line of defense in troubleshooting. The AI can help instrument code with meaningful log statements, which is far more useful than a generic error message.
-
Principle: Field and ACL Debugging
Prompt Idea: "A user with the
itil
role is unable to edit the 'short_description' field on an incident record. We've checked the ACLs but can't find the issue. Act as a ServiceNow debugger and propose a troubleshooting methodology to diagnose the problem. The steps should involve usinggs.hasRole()
, checking the Debug Security logs, and verifying that the correct roles are being evaluated at the time of the action."ServiceNow Specifics: This prompt tests the AI's knowledge of the platform's troubleshooting tools. The ideal response would walk through the logical, step-by-step process that a senior developer would follow to pinpoint a tricky security rule issue.
-
Principle: UI Policy & Client Script Conflict Resolution
Prompt Idea: "A field on a form is unexpectedly read-only for certain users. We have both a UI Policy and a Client Script that affect this field. Propose a debugging plan to identify the source of the conflict. The plan should involve using the Debug UI Policies and Debug Client Scripts tools, analyzing the execution order, and checking for common issues like misconfigured conditions or race conditions. Explain how to use the browser's developer console to watch for DOM changes."
ServiceNow Specifics: This is a very common issue on complex forms. The AI's response should provide a clear, methodical approach to troubleshooting UI issues, emphasizing the importance of native debugging tools and understanding the execution order of client-side scripts and policies.
-
Principle: Integration Monitoring & Payload Analysis
Prompt Idea: "An inbound REST API call from a third-party application is consistently failing to create a record in our
incident
table, but the third-party system shows a '200 OK' status. Create a troubleshooting methodology to diagnose the failure. The steps should include checking the System Logs, enabling the REST API Explorer for testing, and analyzing the transaction record to inspect the incoming payload and identify any errors in the processing script."ServiceNow Specifics: This prompt focuses on debugging integrations. It requires knowledge of how ServiceNow logs inbound transactions and how to use the REST API Explorer to isolate the problem. The AI's response should detail the steps for comparing a successful payload to a failing one to find the root cause.
Additional References:
- Witch Doctor's Playbook: ServiceNow AI by Göran Lundqvist (https://www.amazon.in/dp/B0FQKVYRTM)
- The real problem with vibe coding (https://learn.educative.io/the-real-problem-with-vibe-coding)
- The Rise of Vibe Coding: Innovation at the Cost of Security (https://dzone.com/articles/rise-of-vibe-coding-security-risks)