Skip to main content
Article
servicenow-ai-agentnow-assistitsmincident-managementworkflow-automationflow-designerenterprise-ai

Automate Incident Resolution with ServiceNow AI Agent

Configure the ServiceNow AI Agent to autonomously resolve common IT incidents. This guide shows how to enable the agent for a service, define its resolution logic using Flow Designer, and test its automated actions.

intermediate1 hour5 steps
The play
  1. Identify a Candidate Incident
    Start with a high-volume, low-complexity incident category. Good candidates include password resets, VPN access requests, or software provisioning. This ensures a quick win and minimizes risk. Navigate to 'Incidents > All' to analyze your existing incident data.
  2. Activate Now Assist for ITSM
    Ensure the 'Now Assist for ITSM' plugin is active in your ServiceNow instance. As an admin, navigate to 'System Definition > Plugins', search for 'Now Assist for ITSM', and verify its status is 'Active'. This plugin provides the core capabilities for the ServiceNow AI Agent.
  3. Build a Resolution Flow
    Use Flow Designer to create the automated resolution process. Navigate to 'Flow Designer' and create a new Flow. For a password reset, your flow could include actions like 'Look Up Record' (to find the user), 'Send Email' (with a reset link), and 'Update Record' (to resolve the incident with work notes).
  4. Configure AI Agent Topic
    Link your incident category to the resolution flow. Navigate to 'Now Assist > ITSM > Generative AI Topics'. Create a new topic, set the 'Topic Type' to 'Resolution Flow', select your target incident category, and associate it with the flow you built in the previous step. This tells the ServiceNow AI Agent when to trigger your automation.
  5. Test and Monitor the Agent
    Create a test incident that matches your configured category to trigger the agent. Use the 'Starter' script below in 'System Definition > Scripts - Background'. After running the script, monitor the incident record for updates and check the 'Flow Contexts' to see the execution details of your resolution flow.
Starter code
// Run this script in 'System Definition > Scripts - Background' in your ServiceNow instance.
// It creates a test incident to trigger the AI Agent for a 'Password Reset' category.

(function() {
    // Find a valid user to be the caller (e.g., Abel Tuter)
    var userGR = new GlideRecord('sys_user');
    userGR.addQuery('user_name', 'abel.tuter');
    userGR.query();

    if (userGR.next()) {
        var callerId = userGR.sys_id;

        // Create a new incident record
        var incidentGR = new GlideRecord('incident');
        incidentGR.initialize();
        incidentGR.setValue('caller_id', callerId);
        incidentGR.setValue('category', 'software'); // Set your target category
        incidentGR.setValue('subcategory', 'password reset'); // Set your target subcategory
        incidentGR.setValue('short_description', 'User needs password reset - AI Agent Test');
        incidentGR.setValue('description', 'This is an automated test to trigger the ServiceNow AI Agent for password reset resolution.');
        incidentGR.setValue('assignment_group', 'YOUR_SERVICE_DESK_SYS_ID'); // Replace with your Service Desk sys_id
        incidentGR.setValue('contact_type', 'self-service');
        var incidentSysId = incidentGR.insert();

        if(incidentSysId) {
            gs.info('Successfully created incident: ' + incidentGR.number);
            gs.info('View at: /incident.do?sys_id=' + incidentSysId);
        } else {
            gs.error('Failed to create incident.');
        }
    } else {
        gs.error('Test user Abel Tuter not found. Please use a valid user.');
    }
})();
Automate Incident Resolution with ServiceNow AI Agent — Action Pack