100 Scenario-Based ServiceNow Scripting Questions
Incident Management & GlideRecord
- Retrieve active incidents grouped by category.
- Count total incidents logged in the system.
- List the last 5 incidents created yesterday.
- Display incident counts for each state updated today.
- Identify incidents where the caller's manager field is empty.
- Generate 100 incidents with unique short descriptions.
- List incident numbers updated in the last month.
- Find incidents where the caller is marked as VIP or has no VIP status.
- Detect duplicate records in the sys_user table based on email.
- Resolve all low-priority incidents currently in progress.
Client Scripts & UI Policies
- Show an alert with assignment group members when the assignment group changes.
- Make the short description mandatory and description read-only when specific conditions are met.
- Auto-populate user's email and user ID when the user field changes.
- Display an alert if the caller is a VIP without using getReference().
- Set the assignment group to 'Software' when the short description contains 'Software'.
Business Rules & Script Includes
- Prevent form submission if the selected assignment group has no members.
- Create a Script Include with functions to fetch incident details and calculate resolution duration.
- Abort action in a Business Rule if certain conditions are not met.
- Use g_scratchpad to pass data from server to client.
- Implement a Business Rule to auto-assign incidents based on category.
GlideAggregate & Reporting
- Count incidents by category and subcategory.
- Group incidents by multiple fields using GlideAggregate.
- Calculate the number of incidents resolved today.
- Determine the average resolution time for incidents.
- Identify the top 5 categories with the most incidents.
Advanced Scripting Scenarios
- Create a background script to update incidents based on specific criteria.
- Write a script to find users without email addresses.
- Develop a script to deactivate users not logged in for 90 days.
- Implement a script to assign incidents to the least busy technician.
- Create a script to escalate incidents not updated in 48 hours.
Service Catalog & Workflows
- Automatically create a security incident via a normal incident record, ensuring user access.
- Design a catalog item with group name and description, triggering approval and group creation.
- Set up a workflow that creates multiple tasks upon catalog item submission.
- Implement a catalog item that requests multiple services for a new hire.
- Create a record producer that populates fields based on user input.
Change Management
- Configure a change request to require approvals from multiple departments.
- Handle a situation where an emergency change must be implemented immediately.
- Investigate a change request that led to an unexpected outage.
- Implement a change request approval workflow with conditional logic.
- Set up notifications for pending change approvals.
Problem Management
- Identify and document known errors to prevent duplicate incidents.
- Manage a recurring incident by creating a problem record and implementing a fix.
- Use the Known Error Database (KEDB) to assist in incident resolution.
- Measure the effectiveness of the problem management process.
- Automate the creation of problem records from related incidents.
CMDB
- Ensure CI data in the CMDB remains accurate and up-to-date.
- Add a new type of asset to the CMDB.
- Perform CI impact analysis for a service outage.
- Integrate asset discovery tools with the CMDB.
- Implement reconciliation rules to prevent CI duplication.
Flow Designer & Automation
- Create a flow that triggers on incident creation and assigns it based on category.
- Design a flow to send notifications when incidents are updated.
- Implement error handling in a flow using try-catch blocks.
- Use data streams in a flow to process large datasets.
- Schedule a flow to run every Monday at 5 AM.
Integration & APIs
- Integrate ServiceNow with a third-party system using REST APIs.
- Secure external REST API endpoints in ServiceNow.
- Implement OAuth 2.0 for outbound integrations.
- Handle pagination in REST message responses.
- Expose a ServiceNow table as a REST API securely.
Security & Access Control
- Use GlideRecordSecure to verify user access before creating records.
- Implement ACLs to restrict access to sensitive data.
- Use canRead() and canWrite() functions to check permissions.
- Set up role-based access controls for different user groups.
- Audit user activities for compliance purposes.
Miscellaneous Scenarios
- Create a script to find users with duplicate email addresses.
- Develop a script to deactivate inactive user accounts.
- Implement a script to send reminders for pending approvals.
- Create a script to archive old incident records.
- Design a script to auto-close incidents after resolution.