0% found this document useful (0 votes)
41 views128 pages

Universal Use Cases Documents - ServiceNow

The document outlines various scenarios and scripting challenges related to ServiceNow, including automation of task creation, incident management, and data handling. It includes specific business rules, script includes, and GlideRecord queries to enhance functionality and streamline processes within the platform. Additionally, it presents advanced scripting challenges aimed at improving efficiency and user experience in ServiceNow operations.

Uploaded by

prasadhatte51
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views128 pages

Universal Use Cases Documents - ServiceNow

The document outlines various scenarios and scripting challenges related to ServiceNow, including automation of task creation, incident management, and data handling. It includes specific business rules, script includes, and GlideRecord queries to enhance functionality and streamline processes within the platform. Additionally, it presents advanced scripting challenges aimed at improving efficiency and user experience in ServiceNow operations.

Uploaded by

prasadhatte51
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 128

Scenerio1 :

When Story record is created then it should automatically create 4 different scrum tasks
records of development, testing, analysis and documentations.

Scenario2: There should be a field on problem form which should show the number of
incident records associated with the same problem.

Scenario3: If all the catalog tasks requests are closed completed then request item should
automatically closed.

Scenario4: user should not be able to resolve the incident if change record mentioned in
change request field is not closed.

Scenario5: if users updates work notes of problem task then it should update same work
notes in parent problem record as well with highlighting problem task number.

Scenario6: how to copy attachments from one task to another in ServiceNow.

(function executeRule(current, previous /*null when async*/) {

// Add your code here


if (current.hasAttachments())
{
var gr = new GlideRecord('sc_task');
gr.addQuery('request_item',current.sys_id);
gr.query();
while (gr.next())
{
var a = new GlideSysAttachment();

a.copy('sc_req_item',current.sys_id,'sc_task',gr.sys_id);
}
}
})(current, previous);

Scenario7: Prevent duplicity- Prevent user to raise an incident if a already exists incident
with same caller and same short description

Scenario8: Check task status for RITM – prevent user to mark a RITM closed complete if
related task are not closed. Also display task hyperlink in the information message.

Scenario9: Prevent deleting under warranty asset from alm_hardware table

Scenario10: As a Developer I want the KB article author name change to knowledge base
manager when the author is leaves the organization so that all are articles have active
authors.
1. When a "Change Request" is in the "Review" state and is marked as "Rejected,"
automatically set the state of all related tasks to "Cancelled."

2. For any incident that is updated to the "Resolved" state, check if there are other incidents
with the same "Caller" that are in the "On Hold" or "In Progress" state. If such incidents
exist, automatically update their work notes to indicate the resolution of the related
incident and link them together.

3. Implement a rule that when a new "Service Catalog Request" is submitted with a high
priority , it checks for any open incidents from the same user in the past 30 days. If more
than three such incidents are found, change the priority of the new request to "Priority 2" .

4. Ensure that when a "Problem" record is created and categorized as "Major,"


automatically generate a "Root Cause Analysis" task and assign it to a predefined problem
management team.

5. Write Business Rule that prevents deletion of any "Problem" records if there are active
related incidents.
6. Create a Scheduled Script Execution that runs daily to check for incidents that have been
in "New" state for more than 7 days and send a reminder email to the assigned user.
7. Implement a GlideAjax script to fetch and display the number of open incidents for a
specific assignment group on a form.
8. Write a Client Script to dynamically populate a "Related Incidents" field based on the
selected Configuration Item in an Incident form.

9.Write a script that dynamically validates the "Planned Start Date" and "Planned End Date"
fields on a Change Request form to ensure the start date is not in the past and the end date
is after the start date. If the validation fails, display an appropriate error message and
prevent the form submission.

10.Write a script to automatically populate the "Assigned To" field with the manager of the
user who created the incident when the incident's priority is set to "High". Ensure that if the
manager information is not available, an appropriate error message is displayed, and the
field remains empty.

11.Create a script that ensures the "Short Description" field on a Task form is dynamically
updated to include the current date and time whenever the "State" field is changed. Ensure
that the format of the date and time follows the pattern "YYYY-MM-DD HH:MM".

12.Understand what is Inbound action and do the following task :


When a new email is sent to the instance email address, a new Incident record should be
created. In the Incident form:
a. The email Subject should populate the Short description field on the Ticket .
b. The email Body should populate the Description field on the Ticket .
c. The email Sender should populate the Caller field on the Ticket (if not from a register user
this will log as being from an unidentified guest).
d. The Assignment group field on the Ticket form should default to Service Desk.
e. The Contact type field on the Ticket form should default to Email.

13. Create Problem from Incident, when "Create Problem" button is clicked and re-direct to
Problem record created.
14. Make assignment group and assigned to fields editable only to Admin and ITIL. For
others these fields should be readonly.
15. Create Notification using flow. Assigned To should get notified when the Incident is
resolved.
16. Print "<Incident Number> : <Short Description>" into log when Incident is saved.

Scenario 1: Business Rule to update related change request

// Business Rule: Update related change request when incident is closed

function onAfterUpdate(current, previous) {


// Check if the incident state has changed to Closed if (current.state == 7 &&
previous.state != 7) {

// Find related change requests


var changeRequestGr = new GlideRecord('change_request');
changeRequestGr.addQuery('incident', current.sys_id);
changeRequestGr.query();
// Update the state of related change requests to Closed

while (changeRequestGr.next()) { changeRequestGr.state = 3; // Closed


changeRequestGr.update();

} }

Scenario 2: Business Rule to send notification to assigned group

// Business Rule: Send notification to assigned group when Service Request is


created

function onAfterInsert(current) {
// Check if the assigned group field is populated if (current.assigned_to != '') {

} }

// Send an email notification to the assigned group


var groupGr = new GlideRecord('sys_user_group');
groupGr.get(current.assigned_to);
var groupName = groupGr.name;
var notificationGr = new GlideRecord('sys_notification');
notificationGr.initialize();
notificationGr.name = 'Service Request Notification';
notificationGr.type = 'email';
notificationGr.message = 'A new Service Request has been created.';
notificationGr.recipient = current.assigned_to;
notificationGr.insert();
Scenario 3: Script Include to retrieve active incidents assigned to a user

// Script Include: Get active incidents assigned to a user

var ActiveIncidents = Class.create();


ActiveIncidents.prototype = {
initialize: function() {},

getActiveIncidents: function(userId) {
var incidentGr = new GlideRecord('incident'); incidentGr.addQuery('assigned_to',
userId); incidentGr.addQuery('state', '!=', 7); // Not Closed incidentGr.query();

var incidents = [];


while (incidentGr.next()) {
var incident = {
'sys_id': incidentGr.sys_id,
'number': incidentGr.number,
'short_description': incidentGr.short_description

};

incidents.push(incident);
}
return JSON.stringify(incidents);
}

};

Scenario 4: Script Include to format date and time

// Script Include: Format date and time


var DateTimeFormatter = Class.create();
DateTimeFormatter.prototype = {
initialize: function() {},
formatDateTime: function(date) {
var formattedDate = date.getDate() + '/' + (date.getMonth() + 1) + '/' +
date.getFullYear();
var hours = date.getHours();
var minutes = date.getMinutes();
var ampm = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12;
minutes = minutes < 10 ? '0' + minutes : minutes;
var formattedTime = hours + ':' + minutes + ' ' + ampm;
return formattedDate + ' ' + formattedTime;
}

};

Scenario 5: Script Include to interact with external REST API

// Script Include: Interact with external REST API


var ExternalAPI = Class.create();
ExternalAPI.prototype = {
initialize: function() {},
// Public method to retrieve information from external API
getExternalData: function() {
var url = 'https://api.example.com/data';
var response = this._sendHttpRequest(url);
var data = this._parseResponse(response);
return data;
},
// Private helper method to send HTTP request
_sendHttpRequest: function(url) {
var httpRequest = new sn_ws.RESTMessageV2();
httpRequest.setHttpMethod('GET');
httpRequest.setEndpoint(url);
var response = httpRequest.execute();
return response;
},
// Private helper method to parse response
_parseResponse: function(response) {
var data = JSON.parse(response.getBody());
return data;

} };

Scenario 6: Debugging a Script Include

// Script Include: Debugging example


var DebuggingExample = Class.create();
DebuggingExample.prototype = {
initialize: function() {},
// Method to retrieve data
getData: function() {
try {

} };

gs.info('Starting to retrieve data...');


var dataGr = new GlideRecord('table_name');
dataGr.query();
var data = [];
while (dataGr.next()) {
var item = {
'sys_id': dataGr.sys_id,
'field_name': dataGr.field_name

};

data.push(item);
}
gs.info('Data retrieved successfully.');
return data;
} catch (e) {
gs.error('Error retrieving data: ' + e.getMessage());
return null;
}

In this example, we've added logging statements using gs.info() to track the execution of the
script. We've also wrapped the code in a try-catch block to catch any errors that may occur. If an
error occurs, we log the error message using gs.error().

Scenario 7: Script Include to perform complex calculation

// Script Include: Perform complex calculation


var ComplexCalculation = Class.create();
ComplexCalculation.prototype = {
initialize: function() {},
// Method to perform complex calculation
calculateValue: function(recordId) {
var gr = new GlideRecord('table_name');
gr.get(recordId);
var relatedRecordsGr = new GlideRecord('related_table_name');
relatedRecordsGr.addQuery('parent', recordId);
relatedRecordsGr.query();
var sum = 0;
while (relatedRecordsGr.next()) {
sum += relatedRecordsGr.field_name;
}

return sum; }

};

Advanced ServiceNow Scripting Challenges


1. Complex Business Rule with Multiple Conditions

 Script Objective: Write a business rule that triggers on the incident table. The rule should
fire only if the incident priority is 'High' and the incident category is 'Network Issue', but not
if the incident state is 'Closed'.
 Challenge: Ensure the script includes complex conditions, handles different scenarios, and
performs actions like sending notifications or updating fields.

2. Script Include for Reusable Functions

 Script Objective: Create a Script Include that provides reusable functions for calculating SLA
times. Include methods to calculate the remaining SLA time, the elapsed time, and to
determine if an SLA is breached.
 Challenge: Ensure the Script Include is efficient, follows best practices, and can be called
from various Business Rules or Client Scripts.

3. Advanced Client Script with GlideAjax

 Script Objective: Develop a client Script that uses GlideAjax to call a Script Include and
retrieve data based on user input. The client script should dynamically populate a field on
the form based on the data received from the server.
 Challenge: Handle asynchronous data retrieval and ensure that the UI updates smoothly.
Address potential issues with data synchronization and error handling.

4. Scheduled Job with Custom Script

 Script Objective: Create a Scheduled Job that runs every night at midnight. The script should
identify all incidents older than 30 days and automatically update their state to 'Resolved', if
they are in 'In Progress' or 'On Hold' states.
 Challenge: Implement efficient query handling, ensure proper logging of actions, and handle
exceptions that may arise during the execution.

5. Service Catalog Item with Custom Workflow

 Script Objective: Design a Service Catalog item that initiates a custom workflow. The
workflow should include multiple approval stages, conditional tasks based on user input, and
an automated email notification at each stage.
 Challenge: Create complex workflow logic, handle approvals dynamically, and ensure
integration with the Service Catalog.

6. REST API Integration Script

 Script Objective: Develop a script to integrate with an external REST API. The script should
retrieve data from the API and create or update records in a custom table in ServiceNow
based on the response data.
 Challenge: Handle authentication, manage API rate limits, and ensure proper error handling
and data mapping.

7. GlideRecord Script with Complex Queries

 Script Objective: Write a GlideRecord script that performs a complex query on the
change_request table. The script should return records where the change request is of type
'Emergency', has a priority of 'Critical', and has been assigned to a specific group.
 Challenge: Optimize the query for performance, handle large datasets, and process the
retrieved records efficiently.

8. Data Transformation Script

 Script Objective: Create a Data Transformation script to import data from a CSV file into
ServiceNow. The script should map fields from the CSV to the appropriate fields in the
cmdb_ci_computer table and handle any data validation or transformation needed.
 Challenge: Ensure accurate data mapping, handle different data types, and manage
potential data transformation errors.

9. User Access Management Script

 Script Objective: Develop a script to automate user role assignments based on specific
criteria. For example, assign a particular role to users based on their department or location
in the user profile.
 Challenge: Handle role assignments efficiently, manage exceptions, and ensure that role
changes are accurately reflected in the user's profile.

10. Custom GlideRecord Query with Aggregation

 Script Objective: Write a GlideRecord script to aggregate data from the incident table. The
script should calculate the average resolution time per category and return the results in a
formatted output.
 Challenge: Implement data aggregation and calculations, handle large datasets, and ensure
that the results are accurate and well-presented.

Create a script to generate a unique identifier for a custom


record.
2. Write a script to update a user's department based on their
job title.
3. Create a script to delete all records older than a specified
date.
4. Write a script to send a notification when a high-priority
incident is created.
5. Develop a script to assign a task to a specific group based
on the task's category.
6. Create a script to validate user input on a custom form.
7. Write a script to update the location of all users in a
specific department.
8. Develop a script to close all open incidents for a user when
their account is deactivated.
9. Write a script to export specific data from ServiceNow to
an Excel file.
10. Create a script to calculate the total cost of all open
incidents.

. Write a GlideRecord query to find all incidents related to a


specific CI.

Create a GlideRecord query to retrieve all active users in a


specific domain.

3. Develop a GlideRecord query to find all


open incidents assigned to a specific group.
4. Write a GlideRecord query to find all
problems related to a specific incident.
5. Create a GlideRecord query to retrieve all
incidents with a specific priority and
assignment group.
6. Develop a GlideRecord query to find all
changes scheduled for a specific
maintenance window.
7. Write a GlideRecord query to find all open
tasks with a specific assignment group and
due date.
8. Create a GlideRecord query to retrieve all
knowledge articles related to a specific
category.
9. Develop a GlideRecord query to find all
service catalog items in a specific category
with a specific price.
10. Write a GlideRecord query to find all
users in a specific department with a specific
job title.
1. Create a UI policy to enforce a specific
UI Policies and
format for the 'Short Description' field on the
Client Scripts
Inci dent form.
2. Write a client script to validate user input
on a custom form.

Create a client script to auto-populate fields on a form based


on user input.

. Develop a script include to generate a unique code for a


specific record.

Write a script include to update the status of related tasks


when an incident is closed.

Create a script include to calculate the total cost of all items in


a service catalog request.

Develop a script include to retrieve all users in a specific


group and their manager's information.

Write a script include to send an email notification with


incident details to a specific user.

Write a scheduled job script to clean up old records from a


specific table.

Create a scheduled job script to send a daily report of open


incidents to a specific user.

Develop a background script to update the status of related


tasks when a problem is clos ed.
4. Write a scheduled job script to check for expired licenses
and send notifications to the respective users.
5. Create a background script to sync user data from an
external system into ServiceNow.

Develop a scheduled job script to update the assignment group


of incidents based on the category.

Write a background script to calculate the average resolution


time for incidents and update a report.

Create a scheduled job script to send notifications for


upcoming maintenance tasks.

Develop a background script to check for inactive users and


deactivate their accounts.

Write a scheduled job script to export specific data from


ServiceNow to an external system.

Create a Scripted REST API to allow an external system to


create a new user record in ServiceNow.

Write a script to call an external REST API and retrieve data to


update ServiceNow records.

Develop a Scripted REST API to retrieve specific data from


ServiceNow for an external system.

Create a script to call an external REST API and post data


from ServiceNow to the external system.

Write a Scripted REST API to update specific fields of a


ServiceNow record from an exte rnal system.

Develop a script to call a Scripted REST API to perform a


custom action in ServiceNow from an external system.
Create a Scripted REST API to retrieve all incidents for a
specific user and their manage r's information

Write a script to handle errors and exceptions when calling an


external REST API.

Develop a Scripted REST API to return the total count of


records in a specific table for a n external system.

Create a script to authenticate and call an external REST API


using OAuth 2.0.

Integrate ServiceNow with a monitoring tool to automatically


create incidents based on alerts.

Write a script to sync users and groups from an external


system to ServiceNow using REST APIs.

Develop a custom REST integration to sync assets from


ServiceNow to an external system.

Create a script to integrate ServiceNow with a chatbot


application to manage incident tickets.

Write a REST integration to sync change requests between


ServiceNow and an external project management system.

Develop a custom integration to sync release and deployment


information between ServiceNow and a CI/CD tool.

Integrate ServiceNow with a social media platform to manage


social media posts and comments as tasks.

Create a script to sync problem records between ServiceNow


and an external knowledge management system

Write a REST integration to manage and track customer


requests from an external CRM system.

Develop a custom REST integration to sync HR cases between


ServiceNow and an external HR management system.
Create a basic business rule to automate a repetitive task in ServiceNow.
Whenever work notes activities is updated, update short description of incident table with the user
id details.

- Implement a client Script to validate and enhance form input.

Validate form where you need to check whether user id exists or not or whether a user is having a
valid email domain or not.

Use Glide System functions in a client Script for dynamic behaviour.

Create a Catalogue item where request for will be auto populated with the logged in user id.

Create a script to fetch and display related records using Glide Record.

Display a list of incidents as per logged in user's location with incident location.

Implement a Glide Aggregate script to calculate aggregate values.

Write a script to get the list of active incident records which are assigned to currently logged in
users and get them in priority list view.

- Optimize a complex Glide Record query for better performance.

Try to use error handling try/catch block and scripting best practices to optimize the performance

Use UI Policies to enforce mandatory fields based on conditions.

Whenever caller id is ''Newton Sacs '', make assignment group as mandatory, but it should not be
valid for other users.

Implement a dynamic form that updates based on user input.

Take input from user and update a custom field name as "name".

Create a Client Script to dynamically populate field options.

Auto populate - email, assignment group, company with respect to caller id on an incident table.

Implement a Script Include for common utility functions.

Make 4 utility in a script include function [sum, difference, multiply, divide ] and call them
anywhere and showcase the output

Implement a Script Include for database-related functions.

Create a utility Script Include containing 4 functions to create, update, read and delete records on
any table which is passed as an argument from the user dynamically. And the queries will also be
passed as a parameter dynamically.

Schedule a job to update records on a regular basis.

Scenario: A user reports that they are unable to access a critical business application.

Details: The IT service desk receives the incident ticket and assigns it to a support technician.
The technician troubleshoots the issue, identifies the root cause (e.g., server outage), and
resolves it within the agreed-upon SLA.
Service Request Fulfillment

 Scenario: A new employee needs access to various IT


resources.
 Details: The employee submits a service request
through the self-service portal for access to email,
network drives, and specific software applications. The
request is automatically routed to the appropriate
teams for approval and provisioning.
Change Management

 Scenario: The IT team plans to implement a


major software upgrade.
 Details: A change request is submitted detailing the
proposed changes, potential impacts, and rollout plan.
The Change Advisory Board (CAB) reviews and
approves the change after assessing risks and
dependencies. The upgrade is scheduled during a
maintenance window to minimize disruptions.
Problem Management

 Scenario: Multiple users report intermittent


connectivity issues.
 Details: The IT team identifies a recurring network
problem causing the connectivity issues. A problem
record is created, and a cross-functional team
investigates the root cause. After analyzing network
logs and conducting tests, they implement a
permanent fix to prevent future incidents.
Asset Management

 Scenario: An audit reveals discrepancies


in software license compliance.
 Details: The IT asset manager conducts a
comprehensive audit of software licenses across the
organization using the ITSM tool. They reconcile the
license inventory with purchase records and identify
discrepancies. Remediation actions are taken to ensure
compliance and avoid penalties.

Release Management
 Scenario: The development team prepares to deploy a
new version of a web application.
 Details: The release manager creates a release plan
outlining tasks, timelines, and dependencies. They
coordinate with development, testing, and operations
teams to schedule deployment activities. The new
version undergoes testing in a staging environment
before being rolled out to production.
Service Level Management

 Scenario: A critical IT service experiences frequent


outages, breaching SLA targets.
 Details: The service owner conducts a review of
service performance metrics and SLA breaches. They
identify areas for improvement and collaborate with
technical teams to address underlying issues. Service
level agreements are renegotiated to align with
achievable targets.
Knowledge Management

 Scenario: Support technicians encounter a recurring


issue with a specific software application.
 Details: The technicians document the troubleshooting
steps and resolution in a knowledge article within the
ITSM knowledge base. The article includes detailed
instructions, known workarounds, and related
resources to assist future support incidents.

Capacity Management

 Scenario: An increase in user demand leads to


degraded performance of a critical server.
 Details: The capacity manager analyzes performance
metrics and forecasts future demand. They identify
resource constraints and recommend hardware
upgrades or optimization measures to ensure adequate
capacity and performance.

Access Management

 Scenario: A contractor needs temporary access to


specific network resources.
 Details: The contractor’s manager submits an access
request through the ITSM system. The request is
reviewed and approved based on predefined access
policies and roles. Temporary access rights are granted
for the duration of the contract.
Security Incident Response

 Scenario: The IT security team detects unauthorized


access attempts to sensitive data.
 Details: The security incident is escalated to the ITSM
platform, triggering an incident response workflow.
The team investigates the incident, contains the
breach, and implements security controls to prevent
further unauthorized access.
Service Catalog Management

 Scenario: A department head needs to request


additional software licenses for their team.
 Details: The department head accesses the ITSM
service catalog and submits a request for
additional software licenses. The request is
automatically routed to the appropriate approval
authority and fulfillment team for processing.
Change Advisory Board (CAB) Meeting

 Scenario: The IT department plans to implement a


major infrastructure change.
 Details: The change request is presented to the CAB
during a scheduled meeting. The CAB assesses the
potential impacts, risks, and dependencies of the
change. After thorough review and discussion, the
change is approved, postponed, or rejected.
Emergency Change Management

 Scenario: A critical security vulnerability requires an


immediate patch deployment.
 Details: The IT security team raises an emergency
change request for the patch deployment. The change
is expedited through an emergency CAB meeting for
rapid approval. The patch is deployed urgently to
mitigate the security risk.
Knowledge Article Creation
 Scenario: A support technician discovers a new
workaround for resolving a common issue.
 Details: The technician creates a new knowledge
article detailing the workaround, steps to reproduce
the issue, and troubleshooting tips. The article is
reviewed, approved, and published to the knowledge
base for future reference.
Root Cause Analysis (RCA)

 Scenario: A critical system outage disrupts business


operations.
 Details: The incident response team conducts a root
cause analysis to determine the underlying cause of
the outage. They analyze system
logs, configuration changes, and network traffic to
identify the root cause and implement corrective
actions.
Service Desk Performance Monitoring

 Scenario: The IT service desk experiences a high


volume of support tickets.
 Details: Service desk managers monitor key
performance indicators such as ticket volume,
resolution times, and customer satisfaction scores.
They identify bottlenecks, allocate resources
efficiently, and implement process improvements to
enhance service delivery.
Knowledge Base Maintenance

 Scenario: The ITSM knowledge base contains outdated


or redundant articles.
 Details: Knowledge base administrators conduct a
review of existing articles, identifying outdated or
redundant content. They archive or update obsolete
articles and consolidate similar topics to improve
usability and relevance.

Continuous Improvement Initiatives



Scenario: The IT department aims to optimize service
delivery processes.
 Details: A continuous improvement team conducts
regular reviews of ITSM processes, solicits feedback
from stakeholders, and identifies areas for
enhancement. They implement iterative improvements
to streamline workflows, reduce waste, and increase
efficiency.
IT Governance and Compliance

 Scenario: The organization must comply with industry


regulations and standards.
 Details: The IT governance team establishes policies,
procedures, and controls to ensure compliance with
regulatory requirements. They conduct audits, risk
assessments, and compliance checks using the ITSM
platform to maintain adherence to standards.
Supplier Management

 Scenario: A vendor fails to deliver hardware


components on time, impacting project timelines.
 Details: The procurement team raises a supplier
performance issue within the ITSM platform. They track
vendor performance metrics, escalate the issue to
senior management, and initiate discussions with
alternate suppliers to mitigate risks.
Configuration Item (CI) Baseline Creation
 Scenario: The organization introduces a new standard
server configuration.
 Details: The configuration management team
establishes a baseline for the new
server configuration within the ITSM platform. They
document hardware specifications, operating system
settings, and installed software packages as the
standard configuration template.
User Training and Education

 Scenario: Employees require training on a newly


deployed IT service.
 Details: The training coordinator schedules
Service Level Agreement (SLA) Breach Resolution:

 Scenario: A critical IT service consistently fails to meet


SLA targets for response and resolution times.
 Details: The service owner conducts a root cause
analysis to identify bottlenecks in the incident
resolution process. They collaborate with support
teams to streamline workflows, improve
communication channels, and implement automation to
meet SLA commitments.
Service Continuity Testing

 Scenario: The IT management team observes a


gradual decline in the performance of a critical IT
service over several months.
 Details: Service performance metrics are analyzed
over time to identify trends and patterns indicating
degradation. The ITSM platform generates reports and
dashboards showing historical performance data,
helping stakeholders make informed decisions about
resource allocation and capacity planning.
IT Service Cost Optimization

 Scenario: The organization seeks to reduce IT service


costs without compromising service quality.
 Details: The IT finance manager analyzes cost data
associated with IT services, including
hardware, software licenses, and support contracts.
They identify opportunities for cost optimization, such
as consolidating licenses, renegotiating vendor
contracts, or migrating to cloud-based solutions, to
achieve cost savings while maintaining service levels.
IT Service Portfolio Rationalization

 Scenario: The IT service portfolio contains redundant


or outdated services, leading to inefficiencies.
 Details: The IT service manager conducts a
comprehensive review of the service portfolio,
assessing the relevance, value, and alignment of each
service with business objectives. They retire or
consolidate redundant services, prioritize strategic
initiatives, and reallocate resources to high-impact
projects to optimize the service portfolio.
Mobile Device Management (MDM)

 Scenario: Employees require access to corporate data


and applications on their mobile devices.
 Details: The IT security team implements a Mobile
Device Management (MDM) solution integrated with the
ITSM platform to enforce security policies, remotely
manage devices, and ensure compliance with corporate
standards. They configure device profiles, enforce
encryption, and enable remote wipe capabilities to
protect sensitive data.
IT Service Desk Automation

 Scenario: The IT service desk receives a high volume


of routine requests for password resets.
 Details: The IT service desk automates password reset
requests using self-service options integrated with the
ITSM platform. Users can reset their passwords through
the self-service portal or interactive voice response
(IVR) system, reducing the workload on support
technicians and improving service efficiency.
IT Service Desk Multichannel Support

 Scenario: Users prefer to submit support requests


through various channels, including email, phone, and
chat.
 Details: The IT service desk implements multichannel
support capabilities within the ITSM platform, allowing
users to submit requests through preferred channels.
Requests are automatically routed to the appropriate
support teams for timely resolution, regardless of the
communication channel used.
IT Service Desk Knowledge Management Integration

 Scenario: Support technicians struggle to find relevant


knowledge articles to resolve incidents efficiently.
 Details: The IT service desk integrates knowledge
management functionalities into the ITSM platform,
enabling technicians to search and access relevant
articles directly from the incident ticket interface. They
can quickly reference troubleshooting guides, FAQs,
and resolution steps to expedite incident resolution
and improve customer satisfaction.
Remote Workforce Support

 Scenario: The organization transitions to a remote


work model due to external factors such as a
pandemic.
 Details: The IT support team enhances remote
workforce support capabilities within the ITSM
platform, providing remote access solutions, virtual
desktop infrastructure (VDI), and collaboration tools to
facilitate seamless communication and productivity for
remote employees. They prioritize support for remote
access issues, VPN connectivity, and endpoint security
to ensure business continuity.
IT Asset Lifecycle Management

 Scenario: The organization struggles to track and


manage IT assets throughout their lifecycle, leading to
inefficiencies and compliance risks.
 Details: The IT asset manager implements an IT asset
lifecycle management process within the ITSM
platform, including asset procurement, deployment,
maintenance, and retirement phases. They establish
asset tracking mechanisms, enforce compliance with
licensing agreements, and optimize asset utilization to
reduce costs and mitigate risks.
IT Service Desk Performance Benchmarking

 Scenario: The organization aims to benchmark the


performance of its IT service desk against industry
standards and peers.
 Details: The IT service manager conducts a
benchmarking exercise using performance metrics and
benchmarks available within the ITSM platform. They
compare metrics such as first-call resolution rate,
average response time, and customer satisfaction
scores against industry benchmarks and peer
organizations to identify areas for improvement and
best practices
IT Service Catalog Expansion

 Scenario: The organization introduces new IT services


to meet evolving business needs.
 Details: The IT service manager expands the service
catalog within the ITSM platform to include new
services aligned with business requirements. They
define service offerings, service level agreements
(SLAs), and service request workflows for new services
such as cloud migration, cybersecurity training, or
software-as-a-service (SaaS) implementations.
IT Change Risk Assessment
 Scenario: The organization plans to implement a
major infrastructure change that may impact critical
business operations.
 Details: The change manager performs a risk
assessment using the risk management module within
the ITSM platform. They identify potential risks
associated with the change, assess the likelihood and
impact of each risk, and develop risk mitigation
strategies to minimize adverse effects on service
delivery and business continuity.
IT Service Desk Chatbot Integration

 Scenario: Users seek instant assistance for common IT


support queries outside regular business hours.
 Details: The IT service desk integrates a chatbot or
virtual assistant within the ITSM platform to provide
24/7 support for routine inquiries, password resets, and
service requests. The chatbot leverages natural
language processing (NLP) to understand user queries,
retrieve relevant information from the knowledge base,
and provide automated responses or escalate complex
issues to human agents for further assistance.
Service Level Agreement (SLA) Review and
Revision:
 Scenario: SLAs for certain IT services are consistently
breached, impacting user satisfaction.
 Details: The IT service manager conducts a review of
SLA performance metrics, identifies areas of
underperformance, and collaborates with stakeholders
to revise SLAs. The revised SLAs are communicated to
users, and service improvement initiatives are
implemented to meet the new targets.
Knowledge Sharing Initiative:
 Scenario: Siloed knowledge within different IT teams
hinders collaboration and problem resolution.
 Details: The knowledge management team launches a
knowledge sharing initiative within the ITSM platform,
encouraging technicians to contribute insights, best
practices, and solutions to a centralized knowledge
repository. Regular knowledge sharing sessions and
incentives promote a culture of collaboration and
continuous learning.
IT Service Continuity Planning
for Cybersecurity Threats:
 Scenario: Increasing cybersecurity threats pose risks
to critical IT services and data.
 Details: The IT security team collaborates with IT
service managers to develop and implement IT service
continuity plans tailored to cybersecurity threats such
as ransomware attacks, data breaches, and phishing
incidents. Contingency measures, data backup
strategies, and incident response protocols are
established to mitigate risks and ensure business
resilience.
User Training and Adoption for New IT Services:
 Scenario: The organization rolls out a new
collaboration platform for remote teams.
 Details: The IT training team designs and delivers user
training sessions, tutorials, and instructional materials
to facilitate adoption of the new collaboration platform.
They provide hands-on training, virtual workshops, and
self-paced learning resources to empower users with
the knowledge and skills needed to leverage the
platform effectively.
IT Asset Discovery and Inventory Management:
 Scenario: The organization lacks visibility into its IT
asset inventory, leading to inefficiencies and security
risks.
 Details: The IT asset management team deploys asset
discovery tools integrated with the ITSM platform to
automatically scan the network and discover all
connected devices and software assets. The
discovered assets are reconciled with the centralized
asset repository, and comprehensive asset inventory
reports are generated for tracking, monitoring, and
compliance purposes
IT Change Prioritization and Impact Analysis:
 Scenario: Multiple change requests compete for
limited resources and implementation windows.
 Details: The change advisory board (CAB) prioritizes
change requests based on business impact, urgency,
and dependencies. They conduct thorough impact
analysis to assess potential risks and consequences of
each change, ensuring that critical changes are
prioritized and resource conflicts are resolved
effectively.
Incident Triage and Escalation:
 Scenario: The IT service desk receives a high volume
of incident tickets during peak hours.
 Details: The incident manager implements an incident
triage process within the ITSM platform, categorizing
incoming incidents based on severity, impact, and
urgency. High-priority incidents are escalated to
specialized support teams or subject matter experts for
rapid resolution, while lower-priority incidents are
queued for later processing.
Service Desk Performance Gamification:
 Scenario: The IT service desk seeks to boost agent
morale and performance.
 Details: The IT service manager introduces
gamification elements within the ITSM platform, such
as leaderboards, badges, and rewards, to incentivize
agents and foster healthy competition. Performance
metrics such as ticket resolution times, customer
satisfaction scores, and first-call resolution rates are
gamified to encourage agents to achieve higher levels
of productivity and service quality.
IT Service Catalog Personalization:
 Scenario: Different user groups within the
organization require access to tailored service
offerings.
 Details: The IT service catalog administrator
customizes service catalog views and offerings based
on user roles, departments, and preferences. Role-
based access controls and personalized service
catalogs ensure that users have access to relevant
services and resources aligned with their job
responsibilities and business needs.
IT Service Desk Knowledge Gap Analysis:
 Scenario: Support technicians encounter recurring
incidents for which they lack sufficient knowledge or
training.
 Details: The knowledge management team conducts a
knowledge gap analysis using incident data, user
feedback, and technician performance metrics. They
identify areas where additional training,
documentation, or knowledge sharing initiatives are
needed to address knowledge gaps and improve
incident resolution efficiency.
IT Change Standardization and Automation:
 Scenario: The organization aims to streamline and
automate routine IT changes to reduce human error
and operational overhead.
 Details: The change management team standardizes
and templatizes common change types within the ITSM
platform, such
as software patches, configuration updates, and
routine maintenance tasks. Automated
change workflows, approval processes, and change
scheduling functionalities are implemented to expedite
change execution and minimize disruption to IT
services.
IT Service Desk Customer Satisfaction Survey:
 Scenario: The IT service desk seeks feedback from
users to assess service quality and identify areas for
improvement.
 Details: The IT service manager launches customer
satisfaction surveys within the ITSM platform, soliciting
feedback from users upon incident resolution or service
request fulfillment. Survey responses are analyzed to
measure user satisfaction levels, identify service pain
points, and prioritize service improvement initiatives
based on user feedback and preferences.
IT Service Desk Omnichannel Support Integration:
 Scenario: Users expect seamless support experiences
across multiple communication channels, including
email, phone, chat, and social media.
 Details: The IT service desk integrates omnichannel
support capabilities within the ITSM platform,
consolidating interactions from various communication
channels into a unified ticketing system. Support
agents have access to a centralized interface for
managing tickets and responding to user inquiries
across all channels, ensuring consistent and efficient
support delivery regardless of the communication
medium used by users.
IT Service Desk Performance Benchmarking
Against Industry Standards:
 Scenario: The organization seeks to assess the
performance of its IT service desk against industry
benchmarks and best practices.
 Details: The IT service manager benchmarks key
performance indicators (KPIs) such as average
response time, first-call resolution rate, and incident
resolution time against industry standards and peer
organizations using benchmarking data available within
the ITSM platform. Performance gaps are identified,
and improvement initiatives are prioritized to align with
industry-leading practices and enhance service desk
performance.
IT Service Desk Chatbot Enhancement for Natural
Language Understanding:
 Scenario: Users prefer conversational interactions
with the IT service desk, expecting chatbots to
understand natural language queries and provide
accurate responses.
 Details: The IT service desk enhances chatbot
capabilities within the ITSM platform with natural
language processing (NLP) and machine learning
algorithms to improve chatbot comprehension and
response accuracy. Chatbots are trained on historical
support interactions and knowledge base articles to
understand user
IT Service Desk Remote Support:
 Scenario: A remote employee encounters technical
issues with their laptop while working from home.
 Details: The IT service desk technician utilizes remote
support tools integrated into the ITSM platform to
troubleshoot and resolve the issue remotely. They
establish a secure connection to the employee’s
laptop, diagnose the problem, and apply necessary
fixes without requiring the employee to visit the office.
IT Service Continuity Plan Testing for Natural
Disasters:
 Scenario: The organization conducts a simulation
exercise to test IT service continuity plans in the event
of a natural disaster such as a hurricane or earthquake.
 Details: The IT disaster recovery team orchestrates
the simulation, simulating disaster scenarios and
activating predefined continuity plans. They assess the
effectiveness of backup systems, data replication
mechanisms, and failover procedures to ensure
business continuity and minimize downtime in the
event of a real disaster.
IT Service Desk Shift Handover Process:
 Scenario: The IT service desk operates 24/7 with
multiple shifts, requiring seamless handover processes
between shifts.
 Details: The outgoing shift supervisor conducts a
handover meeting with the incoming supervisor,
reviewing ongoing incidents, pending tasks, and critical
updates. Handover notes and documentation are
entered into the ITSM platform, ensuring continuity of
support and effective communication between shifts.
IT Asset Lifecycle Automation:
 Scenario: The organization automates IT asset
lifecycle management processes to improve efficiency
and reduce manual errors.
 Details: The IT asset management team leverages
automation workflows within the ITSM platform to
streamline asset procurement, deployment,
maintenance, and retirement processes. Automated
notifications, approvals, and asset tracking
functionalities optimize asset lifecycle management
and ensure compliance with asset policies and
standards.
IT Service Desk Major Incident Coordination:
 Scenario: A major incident affecting multiple IT
services requires coordinated response and
communication.
 Details: The IT service desk establishes a major
incident coordination team comprising representatives
from various support teams, management, and
stakeholders. The team utilizes incident management
functionalities within the ITSM platform to coordinate
response efforts, communicate updates, and manage
stakeholder expectations during the incident resolution
process.
IT Service Desk Knowledge Gap Remediation:
 Scenario: Support technicians encounter recurring
incidents stemming from knowledge gaps or
inadequate training.
 Details: The knowledge management team conducts
targeted training sessions, knowledge sharing
workshops, and knowledge gap assessments to address
knowledge deficiencies identified through incident
analysis. They develop training materials, create
knowledge articles, and provide mentorship to
technicians to bridge knowledge gaps and enhance
incident resolution capabilities.
IT Change Standardization and
Approval Workflow Optimization:
 Scenario: The organization streamlines change
management processes to improve efficiency and
reduce change approval times.
 Details: The change management team standardizes
change request templates, approval workflows, and
documentation requirements within the ITSM platform.
They implement automated approval routing,
predefined change templates, and change scheduling
functionalities to expedite change approval and
implementation while maintaining governance and
compliance standards.
IT Service Desk Real-time Monitoring and Alerting:
 Scenario: The IT service desk implements real-time
monitoring and alerting capabilities to proactively
detect and respond to service disruptions.
 Details: The IT monitoring team integrates monitoring
tools and event management functionalities within the
ITSM platform to monitor critical IT services,
infrastructure components, and performance metrics in
real-time. They configure alerting thresholds,
escalation rules, and notification channels to promptly
alert support teams to potential issues and initiate
incident response procedures.
IT Service Desk Capacity Planning:
 Scenario: The organization conducts capacity planning
to ensure that IT resources can meet future demand
and performance requirements.
 Details: The IT capacity management team analyzes
historical performance data, growth projections, and
workload patterns to forecast future demand and
identify capacity constraints. They utilize capacity
planning modules within the ITSM platform to model
scenarios, optimize resource allocation, and make
informed decisions about infrastructure investments
and upgrades.
IT Service Desk Self-service Portal Enhancement:
 Scenario: The organization enhances the self-service
portal to empower users with greater autonomy and
access to IT resources.
 Details: The IT service desk administrator adds new
self-service features, knowledge articles, and service
catalog offerings to the self-service portal within the
ITSM platform. They customize the portal interface,
improve search functionality, and implement self-help
options to enable users to resolve common issues
independently and reduce reliance on support
technicians.
IT Service Desk Chatbot Integration with
Knowledge Management:
 Scenario: The organization integrates chatbot
functionalities with the knowledge management
system to provide users with instant access to relevant
information and support.
 Details: The IT service desk leverages chatbot
capabilities within the ITSM platform, integrating
natural language processing (NLP) algorithms with the
knowledge base to enable conversational interactions
and automated responses to user queries. Chatbots
retrieve relevant knowledge articles, troubleshooting
guides, and FAQs to provide timely assistance and
resolve user issues efficiently.
IT Service Desk Multilingual Support:
 Scenario: The organization provides multilingual
support to cater to a diverse user base with varying
language preferences.
 Details: The IT service desk deploys multilingual
support functionalities within the ITSM platform,
allowing users to interact with support agents and self-
service resources in their preferred language.
Language settings, translation tools, and multilingual
knowledge articles are integrated into the ITSM
platform to enhance user experience and accessibility.
IT Service Desk Performance Analysis and
Benchmarking:
 Scenario: The organization evaluates the performance
of the IT service desk against industry benchmarks and
best practices.
 Details: The IT service manager utilizes performance
analytics and benchmarking functionalities within the
ITSM platform to assess key performance indicators
(KPIs) such as incident resolution times, first-call
resolution rates, and customer satisfaction scores.
Benchmarking data and comparative analysis help
identify areas for improvement and implement service
desk optimization initiatives aligned with industry
standards.
IT Service Desk Incident Prioritization and
Escalation:
 Scenario: The IT service desk implements automated
incident prioritization and escalation rules to ensure
that critical incidents are addressed promptly.
 Details: The IT service desk administrator configures
incident management workflows within the ITSM
platform, defining priority categories, escalation
thresholds, and automated routing rules based on
incident severity, impact, and urgency. Incidents are
triaged, prioritized, and escalated automatically to
appropriate support teams or management levels for
timely resolution and escalation as needed.
IT Asset Discovery and Inventory Management
Automation:
 Scenario: The organization automates IT asset
discovery and inventory management processes to
maintain an accurate and up-to-date asset inventory.
 Details: The IT asset management team deploys
automated discovery tools and asset management
agents integrated with the ITSM platform to scan the
network, identify connected devices, and populate the
centralized asset repository. Automated inventory
synchronization, asset reconciliation, and audit trail
functionalities ensure data accuracy, compliance, and
visibility into the IT asset landscape.

IT Service Desk Incident Analysis and Trend


Identification:
 Scenario: The organization conducts incident analysis
to identify recurring patterns, trends, and root causes
of IT service disruptions.
 Details: The IT incident management team utilizes
incident analytics and reporting functionalities within
the ITSM platform to analyze incident data, identify
commonalities, and detect underlying trends or
systemic issues affecting service reliability. Root cause
analysis, trend identification, and proactive problem
management initiatives help prevent recurring
incidents and improve overall service stability.
IT Service Desk Customer Satisfaction
Improvement Program:
 Scenario: The organization launches a customer
satisfaction improvement program to enhance user
experience and satisfaction with IT services.
 Details: The IT service manager initiates customer
feedback surveys, satisfaction assessments, and user
satisfaction scoring mechanisms within the ITSM
platform to collect user feedback, measure satisfaction
levels, and identify service improvement opportunities.
Action plans, service enhancements, and continuous
feedback loops are implemented to address user
concerns, prioritize service improvements, and
enhance overall customer satisfaction
IT Service Desk Incident Prioritization Based on
Business Impact:
 Scenario: The organization prioritizes incidents based
on their potential impact on business operations and
criticality.
 Details: The IT service desk implements a business
impact assessment framework within the ITSM
platform, categorizing incidents and service disruptions
based on their severity, urgency, and impact on
business functions. Incidents with higher business
impact are prioritized for immediate resolution and
escalation, ensuring that critical business processes
remain operational and uninterrupted.
IT Change Advisory Board (CAB) Meeting
Automation:
 Scenario: The organization automates CAB meeting
scheduling, agenda management, and decision-making
processes to improve efficiency and collaboration.
 Details: The change management team leverages
meeting management and collaboration tools
integrated with the ITSM platform to automate CAB
meeting scheduling, agenda distribution, and decision-
making workflows. Meeting invitations, agenda items,
change proposals, and approval decisions are managed
electronically, streamlining communication, reducing
administrative overhead, and accelerating change
review and approval cycles.
IT Service Desk Customer Feedback Analysis for
Service Improvement:
 Scenario: The organization analyzes customer
feedback and user satisfaction scores to identify
service improvement opportunities and prioritize
enhancement initiatives.
 Details: The IT service manager utilizes sentiment
analysis, feedback categorization, and user satisfaction
scoring mechanisms within the ITSM platform to
analyze customer feedback, identify recurring themes,
and prioritize service improvement initiatives.
Actionable insights, service enhancement
recommendations, and continuous feedback loops are
established to drive service excellence, meet user
expectations, and enhance overall customer
satisfaction.
These scenarios cover various aspects of IT Service
Management, including incident management, asset
management, change management, service desk operations,
and customer satisfaction improvement, demonstrating the
versatility and importance of ITSM in modern organizations.

Network Outage

 Users report being unable to connect to the network.


 Solution: Investigate the root cause of the outage,
communicate with network administrators, and provide
updates through the incident record.
Server Downtime
 Critical servers go offline unexpectedly.
 Solution: Engage server administrators to identify the
cause, perform troubleshooting steps, and initiate a
recovery plan to restore services swiftly.
Data Loss

 Users report missing or corrupted data.


 Solution: Assess backup systems for data restoration,
identify the cause of data loss (e.g., hardware failure,
human error), and implement preventive measures.
Email Service Disruption

 Users are unable to send or receive emails.


 Solution: Check email server status, investigate
potential issues such as configuration errors or server
overload, and communicate estimated resolution times.

Software Installation Issues


 Users encounter errors while installing software.
 Solution: Verify system compatibility, troubleshoot
installation errors, and provide step-by-step
instructions or alternative installation methods.
Printer Malfunction

 Users report inability to print documents.


 Solution: Check printer status, troubleshoot
connectivity issues, and provide instructions for
clearing paper jams or replacing ink cartridges.
Password Reset Requests

 Users forget their passwords and require assistance.


 Solution: Verify user identity, reset passwords
following security protocols, and offer guidance on
password management best practices.
Slow System Performance

 Users complain about sluggish system performance.


 Solution: Monitor system resources, identify
performance bottlenecks (e.g., high CPU usage, low
memory), and optimize system configurations or
upgrade hardware if necessary.
Website Downtime

 Users encounter errors when accessing a website.


 Solution: Monitor website uptime,
investigate server logs for errors, and collaborate with
web developers or hosting providers to resolve issues
promptly.
Database Connection Failure

 Applications fail to connect to the database.


 Solution: Verify database server availability, check
connection strings for correctness, and troubleshoot
network or firewall issues affecting database access.
Application Access Denied
 Users are unable to access specific applications.
 Solution: Review user permissions, ensure proper
access controls are in place, and troubleshoot
authentication issues.
Mobile Device Syncing Issues

 Users experience problems syncing data on mobile


devices.
 Solution: Check synchronization settings, verify
network connectivity, and provide instructions for
troubleshooting device-specific issues.
File Permissions Error

 Users encounter permission errors when accessing files


or folders.
 Solution: Review file permissions, adjust access
control lists (ACLs) as needed, and educate users on
proper file-sharing practices.
VoIP Call Quality Issues

 Users report poor call quality or dropped calls.


 Solution: Check network bandwidth and latency,
troubleshoot VoIP hardware or software configurations,
and collaborate with telecommunications providers if
necessary.
Security Breach

 An unauthorized user gains access to sensitive


information.
 Solution: Activate security protocols, investigate the
breach to determine its scope and impact, and
implement measures to contain the incident and
prevent future breaches.
Service Interruption Due to Maintenance

 Planned maintenance causes service disruption.


 Solution: Communicate maintenance schedules in
advance, redirect users to alternative services if
possible, and ensure timely completion of maintenance
tasks.
GPS Tracking Failure

 GPS devices fail to transmit location data.


 Solution: Troubleshoot GPS hardware
or software issues, verify satellite signal reception,
and implement backup tracking methods if available.
API Integration Error

 Applications fail to communicate due to API integration


issues.
 Solution: Review API documentation for compatibility
issues, check API usage limits, and debug integration
code to identify and fix errors.
POS System Failure

 Point-of-sale terminals malfunction during peak


business hours.
 Solution: Isolate affected terminals, restart POS
systems, and implement manual sales procedures if
necessary to minimize impact on operations.
CRM Data Corruption

 Customer relationship management (CRM) data


becomes corrupted.
 Solution: Restore data from backups, identify the
cause of corruption (e.g., software bug, hardware
failure), and implement data validation measures to
prevent future corruption.
Scheduled Task Failure

 Automated tasks fail to execute as scheduled.


 Solution: Review task scheduler settings, check for
dependencies or conflicts with other processes, and
rerun failed tasks manually if needed.
VPN Connection Issues

 Users encounter difficulties connecting to the corporate


VPN.
 Solution: Verify VPN server availability, troubleshoot
client-side configuration issues, and provide alternative
access methods if VPN connectivity cannot be restored
immediately
Software License Expiry
 Users experience license validation errors for
essential software.
 Solution: Renew software licenses promptly, update
license keys or subscription details, and communicate
license renewal reminders to relevant stakeholders.
Document Collaboration Error

 Users encounter conflicts while collaborating on shared


documents.
 Solution: Educate users on version control best
practices, implement real-time collaboration tools, and
provide guidance on resolving document conflicts.
Remote Desktop Connection Failure

 Users are unable to establish remote desktop


connections.
 Solution: Verify remote desktop service status,
troubleshoot network connectivity issues, and provide
alternative remote access options if necessary.
Missing Data in Reports

 Reports generated from enterprise systems contain


incomplete or inaccurate data.
 Solution: Review data extraction processes, validate
data sources for integrity, and rerun report generation
with corrected parameters
Video Conferencing Issues

 Participants encounter audio or video problems during


video conferences.
 Solution: Check conference settings, troubleshoot
audio/video device configurations, and provide
alternative communication channels if technical issues
persist.
Malware Infection

 Systems are infected with malware, causing


performance degradation or data loss.
 Solution: Isolate infected systems from the network,
run antivirus scans to remove malware, and implement
security patches or updates to prevent future
infections.
Email Phishing Attack

 Users receive phishing emails attempting to steal


sensitive information.
 Solution: Raise awareness of phishing threats through
security training, report and block malicious email
addresses, and implement email filtering measures to
reduce the risk of phishing attacks.
Software Bug
 Users encounter unexpected behavior or errors
in software applications.
 Solution: Document and reproduce the bug, escalate
it to the development team for investigation, and
release a software patch or update to fix the issue.
Web Server Overload
 High traffic causes web servers to become
unresponsive.
 Solution: Scale up server resources temporarily to
handle increased traffic, optimize website
performance, and implement caching mechanisms to
alleviate server load.
Data Center Power Failure

 Power outage affects data center operations.


 Solution: Activate backup power sources (e.g.,
generators, uninterruptible power supplies), prioritize
critical systems for power restoration, and conduct
post-outage analysis to prevent future incidents.
API Rate Limit Exceeded

 Excessive API requests lead to rate limit errors.


 Solution: Monitor API usage patterns, optimize API
calls to reduce unnecessary requests, and request
higher rate limits from API providers if justified.
Data Migration Error

 Errors occur during the migration of data between


systems.
 Solution: Review migration scripts for correctness,
validate data integrity after migration, and implement
data reconciliation processes to identify and correct
errors.
BI Dashboard Data Refresh Failure

 Business intelligence dashboards fail to refresh with


updated data.
 Solution: Check data source connectivity, review
dashboard refresh schedules, and troubleshoot data
extraction or transformation errors.
Customer Portal Unavailability

 Users are unable to access the customer portal to


submit support requests.
 Solution: Verify portal server status, troubleshoot
authentication issues, and provide alternative methods
for submitting support requests (e.g., email, phone).
SSL Certificate Expiry

 Expiration of SSL certificates leads to security warnings


for website visitors.
 Solution: Renew SSL certificates before expiry, update
certificate configurations on web servers, and
implement monitoring for certificate expiration dates.
Third-Party Service Outage

 Dependency on third-party services leads to service


disruptions.
 Solution: Monitor third-party service status updates,
communicate impact to stakeholders, and implement
contingency plans or alternative service providers if
available.
Backup Tape Restoration Failure

 Attempts to restore data from backup tapes are


unsuccessful.
 Solution: Verify tape integrity and compatibility with
backup systems, clean or repair damaged tapes if
necessary, and consider alternative backup restoration
methods.
LDAP Authentication Error

 Users encounter authentication errors due to


LDAP server issues.
 Solution: Verify LDAP server connectivity, review
authentication settings in the application, and
implement fallback authentication methods if LDAP
authentication cannot be restored immediately.
Inventory Management System Sync Issue
 Inventory data discrepancies occur between physical
inventory and the management system.
 Solution: Conduct physical inventory checks to
reconcile discrepancies, review data synchronization
processes, and implement regular inventory audits to
prevent future discrepancies.
Ransomware Attack

 Systems are encrypted by ransomware, rendering data


inaccessible.
o Solution: Isolate affected systems from the
network, engage cybersecurity experts to
assist with ransomware removal and data
recovery efforts, and implement security
measures to prevent future attacks.
 These scenarios cover a wide range of incidents that
organizations may encounter in their IT environments,
along with potential solutions and best practices for
incident resolution.

Scenario 1:
When a change request is completed, send an email to the assigned to person on all
related problems and incidents informing of the closure.
Scenario 2:
There exists 3 groups : TEST.GRP1, TEST.GRP2, TEST.GRP3. Whenever the Group
manager of these groups is updated (even from NULL), add all those updated users
(managers) in a new group TEST.MGR_GRP
Scenario 3:
On linking, removal or updating the reference field Problem on an incident, post a
work note on the problem record.

1.
2. Incident <Inc_number> is now linked to the problem.
3. Incident <Inc_number> is no more linked to this problem.
4. Incident <Inc_number> is newly linked to the <newPRB_Num> from
<oldPRB_Num>
5. Make sure a work note is posted in every kind of update done to the problem
field on incident.

Scenario 4:
On a OOTB copied incident, display a info message which shows the fields being
copied (not the values), check the incident being a copied incident on a script
include call.
Scenario 5:
Auto-populate new incident form:

 Caller should be the logged in user on a unsaved incident form.


 Apply a prefix SQUAD1 to the Short description, if the first 4 categories of an
incident OOTB is chosen by the user.
 Apply another prefix SQUAD2 to the Short description, if the
In real-time, this can be applied to stories with a specific product chosen by the user.
Scenario 6:
Abort (use script to abort) saving an incident, if the short description or description
contains restricted keywords like - (ABC, XYZ). Also log in the script to verify your
output.
Scenario 7:
Alert the user on a incident, while the user changes the impact and urgency that
calculates into a Critical priority. Also trigger an email informing the user that the
incident is now transferred to the major incident group TEST.MJR_INC (create a
group)
Scenario 8:
Prepare a catalog item to request for certification cost reimbursement from your
organization. In the catalog item: (Service catalog > Services)
Input on catalog item:

 certification date,
 ServiceNow certificate - True/false
 Requested for (auto-populates with logged in user name),
 Certification name (choice list),
 Addl. info (String),
 Certification cost (Numeric field), abort submission with alert message, if not
numeric.

Checks:

 Condition for displaying Certification name - only if certification is a


'ServiceNow certificate'.
 If not, Display Annotation above Addl. info field to prompt the user enter the
certification name.
 Validate on submit, if there is an attachment in the cart (Before submission -
attachment is on sc_cart_item)

Approval and Closure, Notification:

 On submission of the catalog item request, there should be an approval


triggered to the 'Requested for' variable manager.
 If approved, set State of request to Closed Complete, if not Closed Incomplete,
as per the respective stages.
 Trigger an email on the request being closed and set the body of the email to
convey to the user:

o That the certification cost will be reimbursed along with salary credit.
o Or the certification cost will not be reimbursed along with the Manager
comments provided for rejection.

Scenario 9:
Display an info message on a incident informing the user, the duration since the
incident is in open state. When it is the Assigned to of the incident viewing the
incident, the info message should read the SLA Breach time left.
Scenario 10:

 Import incident data into ServiceNow, with Category and Short description
inputs provided from an excel (external source).
 Caller is auto-populated according to one of the above scenarios.
 Using a transform map,

o Apply a template A (already created) to prefill all fields that you wish
to, if category selected is A and short description contains a keyword
(choose your own)
o Else pre-fill only the mandatory fields on the incident with fixed values.

Question: 15
Write a reverse array in background scripts 'Reddeppa' (string)?

Script :

var name = 'Reddeppa';


var reversedName = name.split('').reverse().join(''); // Split the string
into an array, reverse it, and join it back
gs.info('Reversed Name:'+reversedName); // Log the reversed
string

Explanation:
split(''): Converts the string 'Reddeppa' into an array of characters.
reverse(): Reverses the array of characters.
join(''): Joins the reversed array back into a string.
gs.info(reversedName): Logs the reversed string 'appeddeR' to the
system logs.

Problem : Remove duplicate from array and replace with some value
Input = [1, 2, 3, 2, 4, 5, 4, 5];
Output = [1, 2, 3, 4, 5, -1, -1, -1];

Code :
var array = [1, 2, 3, 2, 4, 5, 4, 5];
var dupArray = [];
var combinedArray = [];
for (var i = 0; i < array.length; i++) {
for (var j = i + 1; j < array.length; j++) {
if (array[i] === array[j]) {
dupArray.push(array[j]); // Insert duplicate in new array
array.splice(j, 1); //Remove duplicate from main array

}
}

}
var addValue = -1;
var index;
for (var k = 0; k < dupArray.length; k++) {
index = dupArray.indexOf(dupArray[k]); //get the index of element
from duplicate array
dupArray[index] = addValue; // Replacing duplicate element with
value
}
//gs.print(dupArray);
combinedArray = array.concat(dupArray);
gs.info("Output : "+combinedArray);

Scripts:: Using array, how to do, sample codes,


push, join, unshift, lenght, printing
//Creating Array
var fruits = ["Banana", "Orange", "Apple", "Mango"];
//OR you could be use:
//var fruits = new Array("A", "B", "C");

//Inserting new value


fruits.push("Kiwi");

gs.log('====== join======');
//The join() method returns the array as a string.
gs.log(fruits.join());
//*** Script: Banana,Orange,Apple,Mango,Kiwi

gs.log('====== toString======');
//The toString() method returns a string with all the array values,
separated by commas.
var x = fruits.toString();
gs.log(x);
//*** Script: Banana,Orange,Apple,Mango,Kiwi

//The unshift() method adds new items to the


beginning of an array, and returns the new
length.
fruits.unshift("Lemon","Pineapple");

gs.log('====== valueOf ======');


var v = fruits.valueOf();
gs.log(v);
//*** Script: Lemon,Pineapple,Banana,Orange,Apple,Mango,Kiwi
gs.log('====== length ======');
var vLength = fruits.length;
gs.log(vLength);

gs.log('====== Query ======, duplicated cat


itens');
var array = [];
var duplic = new GlideAggregate('sc_cat_item');
duplic.addAggregate('COUNT', 'name');
duplic.addNotNullQuery('name');
duplic.groupBy('name');
duplic.addHaving('COUNT', '>', 1);
duplic.query();

while(duplic.next()) {
array.push(duplic.getValue("name"));
}

var tam = array.length;


gs.info(array.length);

for (var i = 0; i < tam; i++){


gs.info(array[i]);
}

How to create an array of arrays in javascript


from gliderecord results

var grw = new GlideRecord('cmdb_ci_computer');


grw.addQuery('sys_class_name','=', 'cmdb_ci_computer');
grw.query();
var tempArray = []

while (grw.next()) {
tempArray.push(grw.getValue('name'));
tempArray.push(grw.getValue('serial_number'));
old_computers_all.push(tempArray);
}
I need to create an array using values from a custom table in script
step and use its values as outputs for further flow. But I am not sure
how to do so..

Example Script (not using inputs to keep it very simple):


-----
(function execute(inputs, outputs) {

var arrIncidents = new Array(); // Empty array we want to keep the


incident numbers in

var grIncident = new GlideRecord('incident'); // GlideRecord to


incident table
grIncident.setLimit(10); // Only 10 records
grIncident.query(); // query

while (grIncident.next()) { // Iterate through results


arrIncidents.push(grIncident.number.toString()); // push number
of each record into array
}

outputs.arrIncNumbers = arrIncidents; // set output variable to our


populated array

})(inputs, outputs);
-----

You must assign the value of the step output variable to the output
variable in the Outputs section of the action.

I have a requirement in catalog development, our client has shared


values of a catalog item field as below
Display value Yes/No
Abc Yes
xyz No
pqr No
In the drop down field on catalog item fields will be like abc, xyz and
pqr. And based on users selection suppose user selects "abc" it
corresponding Yes/No field has value "Yes" so catalog task 1 should
be created. Similarly if "xyz" is selected then catalog task 1 should
not be created.
Kindly let me how can I achieve this.
How can I set both the above values in a array in script include and
access the yes/no field based on value selection on the catalog item
field.
Note:
1) We are using single workflow for multiple catalog items. Using
script include to access different catalog task short description and
assignment group based on catalog item.
2) These values may vary in future so need to hard code at
minimum level.
3) These values are around 80

===================================

var variablesToCheck = "Abc,xyz,pqr";

var tasksToCreate = [];

variablesToCheck.split(',').forEach(function(varName){
if (current.variables[varName] == 'Yes') {
tasksToCreate.push(varName);
}
});

// Create Task using a seperate Mapping Table ?

var gr = new GlideRecord('CUSTOM_TABLE_HERE');


gr.addQuery('task_var_name', 'IN', tasksToCreate.join(','));
gr.query();

while ( gr.next() ) {
// Create SC Task
var scTask = new GlideRecord('sc_task');
scTask.initialize();
scTask.setValue('request_item', current.sys_id);
scTask.setValue('short_description',
gr.getValue('CUSTOM_SHORT_DESC_FIELD_NAME'));
scTask.setValue('description',
gr.getValue('CUSTOM_DESC_FIELD_NAME'));
scTask.insert();

// May need to copy Request Variables over to sc_task, can't


remember
}
OR you can have the var names in the custom
table
var gr = new GlideRecord('CUSTOM_TABLE_HERE');
gr.query();

while (gr.next()) {
if (current.variables[gr.getValue('u_var_name_field_here')] &&
current.variables[gr.getValue('u_var_name_field_here')] == 'Yes') {

// Create SC Task
var scTask = new GlideRecord('sc_task');
scTask.initialize();
scTask.setValue('request_item', current.sys_id);
scTask.setValue('short_description',
gr.getValue('CUSTOM_SHORT_DESC_FIELD_NAME'));
scTask.setValue('description',
gr.getValue('CUSTOM_DESC_FIELD_NAME'));
scTask.insert();

// May need to copy Request Variables over to sc_task, can't


remember

}
}

How To Pass An Array from Script Includes to Catalog Client


Scripts

var TestApps = Class.create();


TestApps.prototype = Object.extendsObject(AbstractAjaxProcessor,
{

getRoles: function(){

//Retrieve roles
var croles = new GlideRecord('u_lawson_company_codes');
croles.addQuery('u_inactive',false);
croles.query();

var arrRoles = [];


while (croles.next()){
//Fill array
arrRoles.push(croles.u_company_code.getDisplayValue().toString());
}

},

type: 'TestApps'
});

It is set up to be Client Callable, and is accessible from all Scopes.


By running the code in a Background Scripts window, I was able to
confirm that it is working. I did a gs.print on arrRoles, and it
returned what I expected.
Here is my Catalog Client Script, which is running on the loading of
the form:

function onLoad() {

var tlist=[];

//call script include to get array


var ga = new GlideAjax("TestApps");
ga.addParam("sysparm_name","getRoles");
ga.getXML(returnCodes);

function returnCodes(response){
var answer =
response.responseXML.documentElement.getAttribute("answer");
alert("Answer: " + answer);
tlist=answer;
}

Adding new values to an array using Array.push() replaces all values


in the array with the last value pushed

var criticalIncident = [];


var inc = new GlideRecord('incident');
inc.addActiveQuery();
inc.addQuery('priority', '1');
inc.addQuery('category', 'software');
inc.query();
gs.info("Total Records: " + inc.getRowCount());
while (inc.next()) {
gs.info("Incident Number: " + inc.number);
criticalIncident.push(inc.number);
}
gs.info("Critical Incidents: " + criticalIncident);

=================================

et’s not miss these array methods ⬇️

𝟭. 𝗺𝗮𝗽()
- Creates a new array by applying a function to each element.

```
const numbers = [1, 2, 3];
const doubled = numbers.map(num => num * 2);
console.log(doubled); // [2, 4, 6]
```

𝟮. 𝗳𝗶𝗹𝘁𝗲𝗿()
- Creates a new array with elements that pass a test.

```
const ages = [16, 21, 18];
const adults = ages.filter(age => age >= 18);
console.log(adults); // [21, 18]
```

𝟯. 𝗿𝗲𝗱𝘂𝗰𝗲()
- Reduces an array to a single value.

```
const sum = [1, 2, 3].reduce((acc, val) => acc + val, 0);
console.log(sum); // 6
```

𝟰. 𝗳𝗶𝗻𝗱()
- Returns the first element that satisfies a condition.

```
const users = [{ name: "John" }, { name: "Jane" }];
const user = users.find(u => u.name === "Jane");
console.log(user); // { name: "Jane" }
```

𝟱. 𝘀𝗼𝗺𝗲() & 𝗲𝘃𝗲𝗿𝘆()


- `𝘀𝗼𝗺𝗲()` checks if at least one element satisfies a condition.
- `𝗲𝘃𝗲𝗿𝘆()` checks if all elements satisfy a condition.
```
const nums = [1, 2, 3];
console.log(nums.some(num => num > 2)); // true
console.log(nums.every(num => num > 0)); // true
```

Hi All,
Hope you have come across a scenario where you perform certain use
cases on ARRAYS like

1. find element out of the given array


2. find the difference between two array's and what is the difference
value
3. find the index of element if it exists and returns that
4. to merge two arrays without duplicates
5. remove the duplicate item and appear once

The good news is we can use the OOB function (ArrayUtil) of


ServiceNow for this and get our results,
you can use this logic in the script include or any other scripting place
and accomplish your task. This
array solution is helpful especially in the scenarios where you
have fields of a LIST type.
So, below is the logic for all the above use-cases

1. find element out of the given array


var x = [12,13,56,15,178,23,21];
var tst = new ArrayUtil().contains(x,15);
gs.info(tst);

2. find difference between two array's and what is the difference value
var a1 = [12,13,56,15,178,23,21];
var a2 = [12,14,56,15,178,24,25];
var tst = new ArrayUtil().diff(a1,a2);
gs.info(tst);

3. find if the index of element if it exist and return that


var a1 = [12,13,56,15,178,23,21];
var tst = new ArrayUtil().indexOf(a1,15);
gs.info(tst);

4. to merge two arrays without duplicates


var a1 = [12,13,56,15,178,23,21];
var a2 = [14,15,16,17];
var tst = new ArrayUtil().union(a2,a1);
gs.info(tst);

5. remove duplicate item and appear once


var a1 = [12,13,56,15,178,23,21,13,21,65,56];
var tst = new ArrayUtil().unique(a1);
gs.info(tst);

USE CASE SCENARIO'S AND SOLUTION OF


ARRAYUTILS:
Belwo are the use case scenarios to explore each and every
method of ArrayUtil in ServiceNow:
1. MERGE TWO ARRAYS.
2. CHECK IF ARRAY CONTAINS THE REQUIRED VALUE.
3. FIND WHAT ALL DISTINCT VALUE GIVEN ARRAY CONTAINS IN
COMPARISION TO OTHER AVAILABLE ARRAYS.
4. FIND OUT THE INDEX OR POSITION OF REQUIRED ELEMENT IN
AN ARRAY.
5. FIND WHAT ALL ELEMENTS ARE COMMON IN ALL GIVEN ARRAYS
5. COMBINE ALL ARRAYS BUT, IT SHOULD ONLY CONTAIN UNIQUE
VALUES.
6. FIND WHAT ALL UNIQUE VALUE A SINGLE ARRAY CONTAINS.
7. CONVERT JAVASCRIPT OBJECT TO JAVASCRIPT ARRAY.

// Array Utils

var firstArray= ['Green','Brown','Red','Orange','Yellow','Orange'];


var secondArray=['Purple','Black','Green','Blue','Orange'];
var thirdArray=['White','Orange','Green','pink'];
var demoObject={name:'Bean Plant',color:'Green',vegetable:'Beans'};
var arrayUtil=new ArrayUtil();

// Merge two arrays


gs.info(arrayUtil.concat(firstArray,secondArray));

// Check array contains the required value or not


gs.info(arrayUtil.contains(firstArray,'Yellow'));

// Find out all the different values required array contain in


comparision with other
gs.info(arrayUtil.diff(firstArray,secondArray,thirdArray));

// Find out the index or position of an element in an array


gs.info(arrayUtil.indexOf(firstArray,'Orange',2));

// find out only common values in all the array available.


gs.info(arrayUtil.intersect(firstArray,secondArray,thirdArray));
// find out all the unique elements or values available in all the
available array
var fourthArray=arrayUtil.union(firstArray,secondArray,thirdArray);
gs.info(fourthArray);

// Find out the unique value available in an single array or required


array
gs.info(arrayUtil.unique(firstArray));

// Convert Javascript object to javascript array


gs.info(Array.isArray(demoObject));
gs.info(arrayUtil.ensureArray(demoObject));
gs.info(JSON.stringify(arrayUtil.ensureArray(demoObject)));

Hi I am new to servicenow and wanted to create an array of sys_id with gliderecord


This is my current code using a single sys_id but what if I needed to do say 10 sys_id.
How would i put that into an array? What is the best way to do this?

var arr = [];//pass your sys_id's comma separated

for(var i=0; i<arr.length; i++){

var gr = new GlideRecord('sys_data_source');

gr.addQuery('sys_id',arr[i]);

gr.query();

if(gr.next()){

gr.last_run_datetime = '';

gr.update();

Arrays vs Sets in ServiceNow Scripting:


Which One Should You Choose?

Arrays
Think of arrays as your trusty sidekick when it comes to organising data in
ServiceNow. They're like numbered lists that can hold all sorts of stuff – from incident
IDs to user names and everything in between. With arrays, you can keep things in
order, access them by their position, and even have duplicates if needed.
When to Reach for Arrays:
1. Ordered Data: If you need to keep things in a particular order – like
processing incidents in the order they were created – arrays are your go-to
choice.
2. Easy Access: When you find yourself reaching for data by its position in the
list, arrays make it a breeze.
3. Duplicates Welcome: Need to store the same value multiple times? No
problem! Arrays are happy to oblige.

Real-World Example: Let's say you're writing a script to process a bunch of


incidents in the order they were created. An array would be perfect for this job
because it keeps things tidy and lets you access each incident in turn.

var incidentIds = [];


var gr = new GlideRecord('incident');
gr.query();
while (gr.next()) {
incidentIds.push(gr.getValue('sys_id'));
}
incidentIds.forEach(function(id) {
gs.info('Processing incident: ' + id);
});

Sets
Now, let's talk about sets – the neat freaks of the data world. Sets are all about
keeping things unique and tidy. They don't care about order – they just want to make
sure there are no duplicates hanging around. If you need to compile a list of unique
values, sets are your best friends.
When to Choose Sets:

1. Unique Values Only: When you need to ensure there are no duplicates in
your collection, sets have got you covered.
2. Quick Checks: If you find yourself constantly asking, "Is this value already in
the list?" sets can give you a lightning-fast answer.
3. Order Be Damned: Who needs order anyway? Sets don't care about the
order of things – they just want to keep it clean.

Real-World Example: Imagine you're tracking user access to a particular


application. You want to compile a list of unique user IDs without any duplicates. A
set is the perfect tool for this job because it automatically keeps things neat and tidy
for you.

var userIds = new Set();


var gr = new GlideRecord('syslog');
gr.addQuery('application', 'my_application');
gr.query();
while (gr.next()) {
userIds.add(gr.getValue('user_id'));
}
userIds.forEach(function(id) {
gs.info('User accessed the application: ' + id);
});

Choosing Wisely: When to Use Arrays or Sets


So, when should you use arrays, and when should you reach for sets? Here's a quick
cheat sheet to help you decide:
Use Case Array Set
Not a
Ordered Data Yes
priority
One and
Duplicate Values Sure thing
only
Quick Existence Not the Lightning
Check best fast

Conclusion: Finding Harmony in Your Scripts


In the end, choosing between arrays and sets in ServiceNow scripting boils down to
your specific needs. Arrays are great for keeping things in order and allowing
duplicates, while sets shine when you need to ensure uniqueness and fast existence
checks. By understanding the strengths of each data structure, you can write
cleaner, more efficient scripts that get the job done without breaking a sweat

 Use cases
 On form two dates field , if data1 is not equal to
 1
date2 the string field should populate.
 If there is a custom field on click of UI action I
want to populate count of incident which are
 2 from same assignment group and I want to show
this field to only admin or ITIL user which
modules you will use for this?
 If there are client A and client B, Client A should
not see applications for client B and vice versa
 3
how you will do this other than domain
separation?
 If there is 4 variables on service catalog, i want
 4 to auto populate 3 variables on the basis on 1
variable. How will you achieve?
 There is incident form. On incident form there is,
on hold field & on hold reason field. If caller
 5
added any comments on incident, the incident's
state will be in progress. How will you achieve?
 6  There is incident form. On incident form there is,
incident task related list. On incident task
related list there is new & add UI action. I want
to show that ui action if incident is in in progress
state. How will you achieve?
 I want to move list of incidents from 1
 7 development instance to UAT instance. It is in
GB size. How will you transfer?
 There is custom table, in that there is 2 fields.
User_id & email_id. I want to update the record if
 8
email_id is empty. Which coalesce condition you
will apply?
 What is the Backend table name of business
 9
rule, ACL, reports?
 if we already discovered one particular machine
 10 and if we again try to discover it in which phase
of discovery will start.
 There is a catalog item variable ‘Requested for’ ,
 11 I want to populate logged in user’s name in that
field .
 Catalog item status if not completed then wait 5
min to approve and if manager does not
 12 approve then again wait for 5 min for another
approval if he does not approve then status will
be changed to on-hold?
 Suppose we are creating catalog task and we
want to create one type of task for employees
related to A company and different task for
 13
employees related to B company and different
task for employees related to C company how
we can do this.
 There is table Location with field (building name,
city, street etc).
 14
In service catalog when you select location field
you need to auto populate building name.
 Suppose there are 2 tables Location & Building.
 15 Now when you are selecting location you need
to display Buildings under that location.
 Write a script to calculate the time taken from
 16 ‘new’ to ‘in progress’ state of incident and
display on form field.
 Suppose there are 5 groups A,B,C,D,E.on submit
of incidents, on user table if summary contains
 17
string AD And location is A then assign group A
to user(do same for all groups).
 I have a excel sheet containing 100-200 records
and I want to perform
validations before transforming. Each and every
 18
record must pass all the validations if a single
record
fails no record should be entered.
 There is variable in service catalog which only
 19 should be visible to user which are from India
location.
 20  There is a flat file of excel sheet present we
need to populate 100 computer records from
this excel sheet into our ServiceNow CMDB and
there is one link field present in each record
which should be an attachment into our
ServiceNow system records and it should
download that attachment from the link if IP of
the location given.
 The CMDB Tables are in relationship with
cmdb_ci>application>business application, I
 21
need to populate the service on incident form
based on CI's parent .
 I want to auto populate callers mail id in email
 22
field?
 Based on Assignment group auto populate the
 23
users.
 How to get the current and previous values of
 24
field .
 IF user is not member of Service Desk Group
 25
then Cancel the form submission?
 ACL Scenario:role:1)admin2)normal user; only
 26 admin can edit fields of table normal user can
read.
 If incident is created by logged in user it should
 27
be only visible for that user?
 How to create record on specific date
 28
automatically on incident form?
 29  write down script to create a task.
 If you have 10 same variables on different
 30
catalog items will you create on each item?
 In a catalog item there are two variables, both
variables refer to same table. I want to show one
column data of the referenced table in variable1
 31
and at the same time want to show another
column data of the referenced table in
variable2.
 If I have an array in Run Script activity which
consists of 3 different user email ids and I want
 32
to send notifications to those 3 users? How can I
achieve it?
 There is 1 catalog item, on that there are 4
 33 fields. 1 field is requested by, on the basis of
this I want to populate other details of user.
 There is incident form. On that record problem is
attached. If problem is attached then name of
 34
the problem will populate in description field of
incident.
 There is incident table. I want count of the
 35
incidents using background script.
 If I want to make a field mandatory and also it
 36
should not be empty then what should I use?
 How will you allow specific users to write in an
 37
incident field?
 After selecting a caller, manager of the caller
 38
should auto populate in the below field.
 I want to give write access to manager field to
 39
an end user, how will you achieve this?
 40  write a code to get the date values of start date
and end date fields on incident form and set an
error message if the start date is greater than
end date.
 If in user table there is a field ‘type ‘ in which
there are 3 types A,B,C each user is given a type
 41
, now if type A user logs in he should be able to
see only type A users how will you achieve this.
 If there are 3 approvals. All procedure
implemented and moved to production. Again
 42 client requirement come and he told remove
2nd approval. when again implemented this
requirement what n how the process will be?
 When I am opening a new form of incident, then
I want to show only specific 5 fields on the form.
 43
And when the form is submitted, then form will
be open in default view. How to achieve this?
 I am opening incident form. And there is Caller
 44 field on it. And there is 1 UI action show related
incidents. What it called as?
 Convert string field to date field while
 45
transforming data.
1. Make an ITIL user see the “additional comments” label as “additional
comments (customer visible)”. For rest all it must be 'Additional Comments'.
(Done via Client Script)
2.
3. Make 'assigned to' mandatory if 'assignment group' is populated (Use Client
script)

3. Make the state to 'In Progress' from 'New' if the 'assigned to' gets populated from
empty to some value. Also, flash the state variable for 3 to 4 seconds to mention the
logged in user that the value is changed and it is in In Progress state. (Use client
script)

Create a record in Related List(may be a task ) which is associated to main record


(eg. like Incidnet and Incident task are associated)
2) Create a UI action for creating a record in another table.
3) Only show the valid states which comes next in Incident rather than showing all
Like New,Hold ,In Porgress ,Resolved ,Closed .
Means first as soon as Incident is created so it is in New State so the next possible
states are In Progress and Hold and do not show option of closed directly.
4) Configure the workflows as per requirement like if the status changes requested
to approved a Task shoud be created.
5) Only give specific users should have ability to download reports etc.

Incident Management Real Time Scenarios:


1. Create Pending Appointment option in State field.
2. When incident ticket assignee selects Pending appointment option
then date field should appear below the state field.
3. Date/time field should not accept date/time less than today+5hours.
4. If assignee change the state to pending appointment and select the
date in date field and save the incident ticket than a Calendar invite
to be sent to requester when ticket is placed in "Pending-
Appointment" state.
5. When the requester is not able to respond to the appointment as
scheduled then Breached Email notification should be triggered.

2. Survey in Service Request Catalog/Incident Management-


2.1 When a user accepts/rejects the resolution of an incident or
catalog item, he should be directly taken to the survey page.
Create survey page with various ratings options such as
Satisfied, Dissatisfied and Very Dissatisfied, which user can
rate.
2.2 Trigger an email notification to the predefined Distribution List
(Assignment group members), if the User rates the Survey as
"Dissatisfied/Very Dissatisfied"
2.3 In Incident Management, create an "Affected CI" lookup field
where columns (CI ID, Class, Description) should be displayed
2.4 In Incident Management, notes should be mandatory when
Urgency and Impact is modified.
2.5 Urgency field in Incident management form, should be editable
after the ticket is submitted from both ESS and ITIL View until
the ticket is moved to Resolved Status.
Change Management Real Time Scenarios
 There should be an error message pop up displayed while saving the
change ticket to requester when he is also the only approver of that
ticket.
 In Change Management, the Planned Start Date and the Planned
End Date. (Hint: If these two fields are not available in change form,
then create the same)
 In Change Management, "Planning" tab should be mandatory while
creating the change ticket.
 In Change Management, Requester will be notified, when change is
been raised during Moratorium period. (Hint: it means when user
create change ticket at any specific period, then user or requester will
be notified through any pop-up message or through email, for
implementation you can consider any specific period for the same).

Problem Management Real Time Scenarios:


 In Problem Management, based on the Category and Sub Category,
the Problem Management Group should auto populate when
requestor submit or create the ticket.
 In Problem Management, In the list view of Problem tickets, the
Change tickets related to a Problem ticket should be visible.
 When a problem ticket is created from related list available in incident
management, then the following fields will be auto-populated in
problem record Category, Sub Category, Summary, Description,
Priority. (Hint: If any of the field is not available in the incident form or
problem form, then first create the same and then implement the
requirement)

Knowledge Management Real Time Scenarios:


 In Knowledge Management restrict the user to enter blank spaces as
a feedback in KB feedback section. (Hint: if KB feedback section is
not there, first creating the same)
 Assignment Group should be populated on the basis of Category and
Sub Category.
 Knowledge article should get auto retired after 18 months from the
reviewed date. (Hint: if reviewed date field is not there in knowledge
article, then create it first and then implement the functionality)

ServiceNow Requirement for ServiceNow admin


Perspective:
1. Create Groups in your ServiceNow personal instance:
 ServiceDesk Group
 Change Management Group
 Problem Management group
 2. Create Roles such as change_management role, service_desk
role, problem_management role and assign these roles to above
created group.
 3. Create some users and add users to group accordingly along with
above roles and ITIL role.
 4. Create simple user and do not give them above and the ITIL role.
(End User with no roles)
 Create list collector variable referencing to a "sys_user" table and
populate email id's of selected user in another multiline text box field
using client script.
Requirement:
1). Create new Category "Radio" for Incident
2). Under Radio Category, create Subcategories: Hand Held Radios, Base Stations, Repeaters
and Antennas
3). For Radio Category, all Incident should be Auto Assigned to "Radio Support" group.

Transform Request to incident

 Create a UI action named Transform as incident. A popup should ask for


confirmation.
 This UI action will perform
o The creation of the incident with the following mapping from the request:

Request form Incident Form


Opened by Caller
Company Company
Business service Business service
Short description Short description
Description Description

An the below fields set to those values


Field Default Value
Impact 2
Urgency 2
Contact type Self Service
Assignment group = current.user.group
Comments Incident created from request “Request Number”

The current user should fill the other fields

o The cancellation of the request with the comments: Request: “Request


Number” transformed as incident: “incident Number”

Transform Incident to request

 Create a UI action named Transform as request. This UI action is only visible for
users with a role starting by Outsource and request.status is open or assigned or
work in progress. A popup should ask for confirmation.

 This UI action will perform

o Open a UI page with the catalog list


o User selects an item and should fill the information
o Create the request,
o Add, the worknotes: Request created from incident: “incident number” +
Description coming from the incident
o The cancellation of the incident with the comments: Incident: “incident
Number” transformed as Request: “Request Number”

Issue#1 SLA that counts creation time of incident?


Help me please to configure SLA that count the time that has been spent for creation of incident.
Got a task to create the SLA that will be count time between the specialist click NEW(to create new incident)
and SAVE(when the form is filled) - it will be a little time near 1-2 minutes.

I had tried but i got a troubles with triggering (it's not created, i think becouse after specialist click SAVE - the
SLA is already completed and so it's not displayed at all.

I had tried to add the stop condition to pause condition and create some business rules that will change state of
sla to complete - it helps, but i got a lot of bugs after this (SLA repair button doesn't works correctly and ect). So
need a clever one :)

Answers: You could set your stop condition as a pause condition instead.

For example:
Start when active is true - set retroactive start to opened
Pause when created on is not empty.
This way you'll get some SLA's to start up. However you're left with SLA's that are paused. It that's OK, then
you can just mark the stop condition as active is false so that they'll be completed when the ticket is closed.

Issue#2 Any upgrade impact in changing max length of


existing column?
Hi Team,
We have a requirement to do the following:
3. Increase the max length on existing columns.
Couple of queries before making the above change.
1. I verified we have many columns of string type with max length > 4000 in servicecnow tables currently.
However, on oracle instances any string > 4000 characters should be of CLOB type. Do we need to consider this
before increase length > 4000? As per documentation for string type field on oracle instances with > 4000char
( https://docs.servicenow.com/bundle/london-platform-administration/page/administer/reference-pages/
reference/r_FieldTypes.html) , it will be taken care later by logging an incident with support. So can we go
ahead and define max length to around 13000 with String type?
2. Do we see any upgrade impact with the increase in max length of existing columns?
3. What exactly happens when the column max length changes during upgrade? How exactly is upgrade of
table data handled in service now?
Can someone provide your inputs on above queries. Thanks in advance!

Answers:
to answer you question, generally in upgrade, tables matadata doesn't change. You should be fine with columns
length changes.
Just a note : be caution about changing columns length more that 255. A table should not have more than 10
columns with max length 255, this is a mysql innodb imitation.
Issue#3 Scripted rest to update only fields that are changing?

Hi All,

Can someone please help me with some logic and advice on how to update only some fields which have been
updated/changed in the other 3rd party tool(servicenow).and keep the other fields unaffected.

Although, we are getting the request from 3rd party with all the the mapped fields, BUT with every inbound
requests it is updating every field with the same value.For example, even if short description value is "test abc"
initially, it again gets updated to "test abc",once the next inbound comes (which is the same).

Also to note, if the request doesnt send us all the mapped fields ,for obvious reasons i would get code error
while processing the script.

Answers:
Partial update can be done via patch method. Please use patch method to update the resource.
Issue#4 Insert/Send multiple attachments through REST API in
scoped application
Hi All,
I am posting this here as i couldn't find sufficient information over the internet.
Requirement:
Integration of two servicenow instance to send and recieve multiple attachments on INCIDENT module.
Problem Summary:
Of the two ,one instance is having incident in scoped application, thus most of the global scripts(OOB) are
duplicated in scope to facilitate the smooth operations. The latter one may or may not be in scope.
Now as we are aware REST is itself in global application(Correct me if I am wrong),thus most of the
functionality are not going to work. Stating that,we can say basic scripts syntax like GlideSysAttachment might
not work.
So,
1. How to make implement that functionality,i.e Sending and inserting attachment on the target incident on the
other instance.Please provide a code snippet or reference URLs if you can, for better understandings.
2. Also, which method should we use Data Serialization or Data Streaming.

Answers:
i took help from the saveResponseBodyAsAttachment function from the docs, which easily helped on every
insert.
Issue#5 Making an outbound REST call (GET) from inside an
inbound scripted REST API (POST)
I have an incoming webhook with some data(say name) and a link(1). I created a scripted rest api which takes
that name and inserts a record with that name as a field.
Now i also want to make a GET call to that link(1) to get the rest of the data. Any way to do this properly short
of sending the link content as data in the first place(difficult at this moment).
Answers :
So the link1 is an external end point? if not why dont you try fetching the records using gliderecords and pass
it in response?

or maybe a long process of creating multiple get and post api endpoints.

eg.
say your snow url is first accessed,by snowURI1->it fetches record of the external link1->sets the response
body.

Issue#6 Description field type from HTML to String?


Hi,
For a requirement, we changed the field type of Description from String to html and used for few days. But now
we decided to change it back to String type.
The problem here is when we changed back to String, we see some tags in the existing record of incident,
change, ritm and other task tables description(populated when the field type was html) field. Please help to
resolve this.
Thanks in advance.
Answers:
Below code converts HTML string to a text string. You need to run this code for subset of records and update the text string
into that field

var gr = new GlideRecord('task');


gr.get('sys_id');
var htmlDesc = gr.description.getDisplayValue();
var txtDesc = htmlDesc.replace(/<(?:.|\n)*?>/gm, '');
gs.print(txtDesc);

Issue7# Can I generate a popup with contents derived from a


custom activity within a workflow?
I am creating a workflow which would allow a user to reboot a server.
I want to present him with a list of users who are logged into that server, and then let him confirm that he still
wants to reboot. That list is not something that exists in a table, it has to be generated by acustom ssh activity
within a workflow. Then, he can decide to go ahead, or cancel. If he klicks OK, then the reboot workflow would
be initiated.
I see examples of javascript popups in this article: https://www.servicenowguru.com/scripting/client-scripts-
scripting/javascript-popup-boxes-servicenow/, but I don't know if what it talks about can be extended somehow
to do what I am asking here.
Any suggestions would be appreciated.

Answers:
Is this workflow will run if user creates a Request or user run this workflow on demand?. Because, alert is a
client side function and workflow supports only server side scripts. You may follow below process. Run the
powershell activity get the requierd output in json or something and parse the output update worknotes of the
ticket, create an approval to a concerned person ask him to check worknotes if he approves then process next
steps otherwise end the workflow and cancel the request
Issue#8 Load data periodically and insert records?
Hi All,
I have couple of questions:
- I get a file periodically with some data from which I should create requests.
- I would like to understand , where should this file be placed and How should I consume the file to create
requests.
Many Thanks.

Answers:
Hi,
You can use FTP type data source to retrieve a file copied to a folder in server. Navigate to system importsets --
> Data sources click new and you can try the different type of retrieval method by selecting an appropriate "File
Retrieval Method"

Issue#9 What is Auto assessment business rule applied on


incident table?
Function onAfter(){

(new sn_assessment_core.AssessmentCreation()).conditionTrigger(current,
'249e70b0875013005d90bba826cb0bbf');
}

Answers:
This is a system generated business rule for trigger condition you have defined for assessment, If this BR is
deactivated then survey/assessment will not get triggered
Issue#10 IT Onboarding Process?
Goal:
I'm looking for a way to implement employee IT onboarding at our company. I'd like to share my thoughts and
hopefully can get some good ideas from this community on the best way to implement in ServiceNow.
Today:
HR completes an on-line form when a new employee is hired and the page sends an email to mail group
requesting action. Recipients get basic info and begin creating user accounts and etc.
Supervisors then complete a paper form with more specific hardware/software requirements for the new hire.
Future:
The on-line form HR uses today could be modified to send an email to ServiceNow. ServiceNow could parse
the fields and begin building a request. Ideally the supervisor would receive a request that looks like the order
guide with all basic employee information pre-filled. The supervisor could select hardware/software
requirements and all catalog items would be fulfilled by the appropriate team.
I don't know how to save the order guide so that the supervisor could continue the process. Any ideas greatly
appreciate

Answers:
HR Lifecycle Events Cases shows all cases and child cases related to life-cycle events.
You can also view Lifecycle Events cases in the HR Cases list. Refer to Finding HR cases.
The quickest way to find cases assigned to you is to use the HR Service Portal. Refer to Using Employee Service
Center to view your cases.
To create, edit, or track a Lifecycle Events case, refer to Work an HR case.
Once a case is created or modified, under Related Links, there are links unique to Lifecycle Events cases:
 Requested user actions: Shows a list of user actions from the new-hire check list with links to the tasks.
 Activity Set Execution: Shows all activity sets for a life-cycle event.
 Show Workflow: Displays the workflow associated with the Activity Set.
 Create or modify a Lifecycle Events case
HR Lifecycle Events cases contain HR activity sets that contain trigger activities.
Issue#11 Issuing Demand Assessments to customers in
different domains than the domain in which the demand
resides.?
Looking for expertise in the following:

 Domain Separation
 Sending Assessments to stakeholders in other domains

BACKGROUND
We have a domain separated environment. We operate in a domain beneath the Global domain just like any
other client does. Our service offerings to clients are different depending on what they wish to purchase (Gold,
Silver, Bronze).
Our domain structure looks a bit like this:

 Global

o Top
o
 Our Domain
 Gold Customers

 Client A
 Client B
 Silver Customers

 Client C
 Client D
 Bronze Customers

 Client E
 Client F

Within Our Domain, Ideas are converted into Demands, some of which will be implemented in a domain that
will affect clients in other domains. We want to be able to send an assessment to stakeholders in domains that
may be impacted through the implementation of the demand.
For example: we may consider a demand to be implemented in the Gold Customer domain and want to send an
assessment to the stakeholders from Client A and Client B. We do not want Clients C, D, E, F to see the
demands or the assessments.
With the idea and demand residing in "Our Domain", how do we issue assessments to stakeholders in the Gold
Customers Domain?

Answers:
It is very tricky with the requirement what you have.
It has been very straight forward by granting visibility domain permission to users in customer domain to your
domain. But that will grant too much of the access.

Why not to create idea and demand altogether in customer domain?


You can also set the domain of the record by putting "task_for" field populated, "task_for" field is a reference to
sys_user table.
What you can do is grammatically set this field value to any user record in your customer domain. That will
decide the domain of the demand record.
Issue#12 Use of priority field in business rule?
Hi,
Can anyone please let me know the use of priority field on business rule?
I know the use of order field on business rule but not priority field.
Thanks & Regards,

Answers:
Priority field helps in determining the priority to be given for ASYNC business rules.

ServiceNow Real Time Scenario’s


Incident Management Real Time Scenarios:

1a. Create Pending Appointment option in State field.


1b. When incident ticket assignee selects Pending appointment option then date field should
appear below the state field.
1c. Date/time field should not accept date/time less than today+5hours.
1d. If assignee change the state to pending appointment and select the date in date field and
save the incident ticket than a Calendar invite to be sent to requester when ticket is placed in
"Pending-Appointment" state.
1e. When the requester is not able to respond to the appointment as scheduled then Breached
Email notification should be triggered.

2. Survey in Service Request Catalog/Incident Management-


2a. When a user accepts/rejects the resolution of an incident or catalog item, he should be
directly taken to the survey page. Create survey page with various ratings options such as
Satisfied, Dissatisfied and Very Dissatisfied, which user can rate.
2b. Trigger an email notification to the predefined Distribution List (Assignment group
members), if the User rates the Survey as "Dissatisfied/Very Dissatisfied"

3. In Incident Management, create an "Affected CI" lookup field where columns (CI ID,
Class, Description) should be displayed
4. In Incident Management, notes should be mandatory when Urgency and Impact is
modified.
5. Urgency field in Incident management form, should be editable after the ticket is submitted
from both ESS and ITIL View until the ticket is moved to Resolved Status.

Change Management Real Time Scenarios

1. There should be an error message pop up displayed while saving the change ticket to
requester when he is also the only approver of that ticket.
2. In Change Management, the Planned Start Date and the Planned End Date. (Hint: If these
two fields are not available in change form, then create the same)
3. In Change Management, "Planning" tab should be mandatory while creating the change
ticket.
4. In Change Management, Requester will be notified, when change is been raised during
Moratorium period. (Hint: it means when user create change ticket at any specific period,
then user or requester will be notified through any pop-up message or through email, for
implementation you can consider any specific period for the same).

Problem Management Real Time Scenarios:


1. In Problem Management, based on the Category and Sub Category, the Problem
Management Group should auto populate when requestor submit or create the ticket.
2. In Problem Management, In the list view of Problem tickets, the Change tickets related to a
Problem ticket should be visible.
3. When a problem ticket is created from related list available in incident management, then
the following fields will be auto-populated in problem record Category, Sub Category,
Summary, Description, Priority. (Hint: If any of the field is not available in the incident form
or problem form, then first create the same and then implement the requirement)

Knowledge Management Real Time Scenarios:


1. In Knowledge Management restrict the user to enter blank spaces as a feedback in KB
feedback section. (Hint: if KB feedback section is not there, first creating the same)
2. Assignment Group should be populated on the basis of Category and Sub Category.
3. Knowledge article should get auto retired after 18 months from the reviewed date. (Hint: if
reviewed date field is not there in knowledge article, then create it first and then implement
the functionality)

S. No Application Requirement to Implement (User Story)


1 Incident Management When user selects pending from State field dropdown, then one new
field dropdown Sub Status should be displayed below state field,
which contains value such as: Awaiting moderation, Customer
Action, Need Info and Hardware Requested.
2 Incident Management Caller reference field should be auto populated with the logged in
user name.
3 Incident Management There should be button (name as- Assigned Me) at the top, this
button should only display to users those who belongs to selected
assignment group mentioned below Assignment group field in
incident record. Means when selects the assignment group from
assignment group field and he belong to that group then that button
should be visible to him.
4 Incident Management This is related to above requirement, when user click on “Assigned
Me” button then his name will get populated in below Assigned
to reference field.
5 Incident Management Add one field to form, field name is email. This field should display
the email of selected requester. If you change the requester than
email value will also get change. This field should be read only.
6 Incident Management Email notification should be triggered to Assignment Group,
Assignee and Requester when incident ticket assignee fills the
assignment group and save or submit the incident record.
Email body can be: Hi Assignee Name,
Incident ticket number has been assigned to you for resolution.
Note: Incident ticket number, Assignee name should contain
original value
7 Incident Management Email notification should be triggered to Requester when incident
record has been created for him.
Email body can be: Your Incident ticket number has been created.
Will notified you once the ticket gets resolved or any action is
required from your end.
Note: Incident ticket number, Requester name should contain
original value.
ServiceNow Requirement for ServiceNow admin Perspective:
1. Create Groups in your ServiceNow personal instance:
 ServiceDesk Group
 Change Management Group
 Problem Management group
2. Create Roles such as change_management role, service_desk role, problem_management
role and assign these roles to above created group.
3. Create some users and add users to group accordingly along with above roles and ITIL
role.
4. Create simple user and do not give them above and the ITIL role. (End User with no roles)
5. Create list collector variable referencing to a "sys_user" table and populate email id's of
selected user in another multiline text box field using client script.
Below is the screenshot for the clue:

ServiceNow Incident Management Form- Clue.

S. No Application Requirement (User Stories)

1 Service Develop or design service catalog item


Catalog form, which contain below field:
1. Field Name: Requester, Field type:
Reference
2. Field Name: Hardware Requirement,
Field Type: Radio Button)
Options are as mentioned below:
 Laptop
 Desktop
 Mouse
 Keyboard

3. Field Name: Manager, Field type: Text


Box (Read only field)
4. Field Name: Description, Field type:
Text Box

2 Service In the above requirement (S. No 1) when


Catalog user selects Laptop then below field will
display to him which should be
mandatory:
Field name: RAM, Field Type: Dropdown
 250GB
 500GB
 1TB

3 Service In the above requirement (S. No 1) when


Catalog user selects Desktop then below field will
display to him which should be
mandatory:
Field name: Screen Size, Field Type:
Dropdown
 14””
 15.6””
 17””
 19””

4 Service In the above requirement (S. No 1)


Catalog Manager field should be read only and
should automatically populated with
requester manager name. Means when
you select the requester then manager
name of that requester needs to be
populated in that field.

5 Service Now the form is created above right. The


Catalog most important is service catalog
transition flow or workflow. In this
requirement you have to design the
workflow for the created service catalog
item:

Workflow Transition should be, after user


submits the form or user requested for the
above service catalog item, then workflow
transition should be:

1. Should move for approval to the


requester manager mentioned in form.
 If approved by manager then one
task has been attached for fulfillment and
it should be assigned to any assignment
group.
 If rejected by manager then item
or request is closed rejected.

2. When the task is assigned to


assignment group as mentioned above.
Then, If the task is closed complete then
requested item status should be displayed
as completed and if the task is closed
cancelled then requested item status
should be displayed as closed cancelled.

In both the cases above either cancelled or


completed email notification to requester
should be triggered stating about the exact
status.

Solution: Import Group Along With Members, Roles Through XML


In ServiceNow if we talk about group, user and roles then we know that or we should be
aware of below things:
 When we create a role in servicenow, then it captures in local update set.
 But when we create user in servicenow, then it will not capture in update set.
 And when we create group in servicenow then it is also not captured in update set.
So, the problem occurs, when we move group from one instance to another instance because
we know that group and its data will not get captured in update set, so we move it manually
through XML, CSV etc. While moving the data from once instance to another we should be
aware of that from where we export the data and in which sequence, we need to do that.
For example, let’s say, if we move group along with roles and the members assigned to that
group to production instance from the developer instance.

There are lots of ways to do that, you can do it from import xml, CSV or excel etc. So here
we are suggesting only one way that is through XML. Where we import XML from one
instance and export XML to another instance. There are few things which we need to take
care while doing this transaction. We will also cover those at the bottom of this page.

So, Now let’s focus on


how to import groups along with members and roles through XML in ServiceNow:

So, let’s say we have ServiceNow developer instance where we have a group along with
members and roles and now, we want to move this to ServiceNow Production instance.

** Please make sure to do all activities mentioned below, you should have admin roles.

So, first activity which are going to do is exporting the data into XML from one
instance that is ServiceNow Developer Instance:

 So first open ServiceNow developer instance.


 Navigate "User administration -> Groups (sys_user_group.list)" and open the group
which you want to move to another instance.
 Click on let top corner Additional actions (four vertical line image) and then export
it into XML. (This activity is basically for Group Only). You can rename the file if you
want so that while importing you can relate it.
 Now for group members, in application navigator type (sys_user_grmember.list)
and press enter.
 Now filter the results by entering your group name which you want to move.
 Now click on their vertical line displayed along with Name label and export the list
into XML and download the same. (this activity is basically for Group members)
 Now we need to import the roles assigned to group right. so for that type
"sys_group_has_role.list" in application navigator.
 Now filter the results by entering your group name which you want to move.
 Now click on their vertical line displayed along with Name label and export the list
into XML and download the same.
Now the second activity which we are going to do is, importing the data into target
instance that is ServiceNow production instance:
 So first open Target instance or ServiceNow Production instance.
 Navigate "User administration -> Groups"
 Now click on their vertical line displayed along with Name label and click on Import
XML.
 Browse the file you have exported for group and click on upload button. You will
find group gets uploaded into the instance but without role and group members details.
(Manager name will get populated in manager field only if Manager is available in the
targeted instance)
 Now for group members, in application navigator type (sys_user_grmember.list) and
press enter.
 Now click on their vertical line displayed along with group label and click on
importXML.
 Browse the XML file you have exported earlier for group members. You will find
the entries in the same list view.
 Now for roles assigned to that group, in application navigator type
( sys_group_has_role.list) and press enter.
 Now click on their vertical line displayed along with group label and click on
importXML.
 Browse the XML file you have exported earlier for group roles. You will find the
entries in the same list view.
Now you can open the group and validate the data. Group along with group members and
given roles will get populated in targeted instance i.e. in ServiceNow production instance.

As we have mentioned above while doing all above transaction, you


should take care of below things:

 You should check that what all user of the groups are available in the targeted
instance. Otherwise after importing the data in targeted instance those users will be
displayed as empty. So to populate those users you have to export those users XML from
user table and import the same in targeted instance user table. After doing this empty field
automatically replace with username because that empty record contains same user sys_id.
 Same as above for roles. Roles should also be validated otherwise same activity has
to be done for roles as well.
 Make sure that first import the group XML and then import members XML or roles
XML in targeted instance.
For the understanding of this topic we have posted a video on our you tube channel. Please
find the link below which will help you to understand this in details and in practical way.

Concepts of CMDB in ServiceNow


What is CI in ServiceNow ?

CI in servicenow is referred as configuration item and it is used to store information about


hardware and software assets. Ci's record in cmdb includes all of the relevant data, such as
manufacturer, vendor, location, asset id, Model Id,operating system etc. this data is depend
on the Ci class.
Information in CI can be added, deleted and modified in cmdb manually or through cmdb
discovery and cmdb service mapping application. Ci in cmdb can be created or maintained
either using tables, lists, and forms within the platform.

So. to understand the Ci in cmdb in detail. Lets navigate to servicenow application. Please
follow below steps:

1. Navigate to ServiceNow development instance and type cmdb_ci.list (base table of cmdb)
in filter navigator available on left side and press enter.

2. It will open the cmdb_ci table list view as mentioned in below image. "cmdb_ci" is the
base table and all the CI classes in cmdb extend this base table by default.

so all the records displayed in list view are Ci records, Configuration item (cmdb_ci) table
contains all the CI's. Please click on the name which in displayed in list view such as
*ANNIE.
3. After you clicked on the name you will find page as displayed below, which show that CI
record store all the required information as I have mentioned in above definition.

In below image I have tried to display, that how CI in cmdb stores the information of the
Laptop available in organization.

Now as we done with CI in cmdb, lets understand CMDB:

What is CMDB in ServiceNow ?


A configuration management database (CMDB) is a database that contains all relevant
information about the hardware, IP Components and software components etc. used in an
organization's IT services and it also contains the relationships between those components.

So, in this way cmdb in servicenow provides an organized view of configuration data so
that the organization gains the full visibility of its infrastructure and services, leading to
more control of organization environment and better decisions.

There are some core features of cmdb, which helps to manage and maintain the
Configuration data and provides the required information of infrastructure components.
Core features of cmdb are:
 CMDB Health
 CMDB Identification and Reconciliation
 CMDB lifecycle Management
 CMDB baseline
I will post the separate blog to give an understanding of above core features. But below
content will provide required understanding of ServiceNow CMDB.

So Now as we understand that, CI stored in CI classes and Collection of CI classes


forms a Configuration Management Database.

So let's see what is CI Class in cmdb, CI relationship in cmdb and how to create the CI
Class in cmdb.

What is CI Class in CMDB?

CI class in cmdb is actually a table which extends any other table or extended by any other
table. Means a CI class can be parent table if extended by any other table or it can be child
table if it extend any other table. for e.g.

let's say if cmdb_ci (table) is extended


by cmdb_ci_hardware (table) and cmdb_ci_hardware (table) is extended
by cmdb_ci_hardware_laptop (table)

so above basically laptop table is a child table and hardware table is the parent of laptop
table but it is child table of configuration item table.
What is CI Relationship in ServiceNow?

When two CI's in cmdb have dependency on each other in any way then, we can say that
those two CI's have a relationship. In servicenow cmdb there are lots of relationship type,
such as cluster of (parent), stored on (child), uses (parent), runs (child) and many others etc.
So a relationship consist of two CI and a relationship type, please find below image for
understanding:

How to create CI Class in CMDB?


So below are the steps and screenshots, which helps you to create the CI Class in cmdb:
1. Navigate to the servicenow application. Type "configuration" in left side filter navigator
and click on CI class manager as displayed in below screenshot.

2. Once you clicked on CI Class Manager module, click on hierarchy as displayed in below
screenshot:
3. Select any Class under which you want to create your class or you want to extend the
class. Once you clicked the class you will find the "Add child Class" option on right side, if
the selected class extensible checkbox is checked.

4. Now click on Add Child Class and fill the required details as mentioned in screenshot
below and create the CI class in cmdb. for more information you can also see the cmdb
servicenow youtube video attached in this blog above.
So, now I think you are clear about the CI, CI Class, CI relationship and CMDB. Now let's
see that how the CI can be populated/created/stored in cmdb in servicenow. There are
different ways through which CI can be populated.

CI in CMDB can be populated, created and modified in ServiceNow


through mentioned various ways:
1. Manually

User can manually create or modify any CI in cmdb, as i have mentioned in below
screenshot by clicking on new button.

Create CI Manually in ServiceNow Picture9

You can also populate the CI using Import set.


2. SCCM

Through Microsoft SCCM integration you can import SCCM data into cmdb in servicenow.
But remember that you can only perform single direction import from SCCM to cmdb in
servicenow.

3. CMDB Discovery

Cmdb discovery is servicenow product and by using cmdb discovery you can import the
information into servicenow instance from another source and you can also integrate
servicenow cmdb with existing external cmdb. Cmdb discovery is widely used to populate
and manage the CI related data in servicenow cmdb.

So as we discussed above about cmdb discovery, let's see in detail that what is cmdb
discovery and what are the types of discovery.

What is Discovery?

Discovery finds computers, servers, printers, a variety of IP-enabled devices, and the
applications that run on them. It can then update the CIs in CMDB with the data it collects.
Discovery is an ITOM application and it is a paid plugin from servicenow.

Discovery runs on an on-demand or on scheduled basis to help ensure the accuracy of the
configuration item (CI) data underpinning ServiceNow applications across the enterprise

Types of Discovery are:

1. Horizontal Discovery
2. Top-Down Discovery
ServiceNow CI Relationships and ServiceNow CI Relationship Editor

In ServiceNow, the relationship between the configuration items has been captured by
Configuration Management Database. Means a database, where we have lots of CI, CI
Classes or we can say CI tables.

CI classes or CI table in CMDB contains CI's and those CI's having some
relationships.

Here the CI having a technical relationships with other CI such as Used by, Run On,
Consumes, Allocated to and many more etc.

Before we start create CI in CI class and create a relationship between them, let's first
understand what is a CI.

What is Configuration Item (CI) ?

A CI is a record which include or contains all the relevant data or information of all the IT
assets a company have, such as Hardware, IP Address, Network, Warranty details, Software
License, Documentation and many more. CI stores, information such as manufacturer,
vendor, location, asset id, serial number, DNS etc.
CI information can be modified, added and deleted.
Some of CI Types are: Hardware, Software, Server, Clusters, Database
servers, IP Networks, Software licenses, Locations, Data center, VPN etc.

Now let's talk about CI's Relationship.

What is CI Relationship in ServiceNow?

Relationship is basically the dependency of one CI to another CI and CI can have multiple
relationship. For e.g Software runs on Windows and Window install on Computer and
Computer use Server.

So, each CI relationship has a starting Point, target point and a verb. Where you can say that
starting point is parent CI and target point is Child CI vice versa and a verb is basically a
relationship type between both the CI's.

Below is the image which will elaborate above text:

CI Relationship in ServiceNow
CI's can also have relationship with users and group. Below screenshot will provide you the
idea that from where in ServiceNow you can navigate and find the CMDB module.

CI Relationship Types in ServiceNow

Under relationship of configuration application you will find modules as displayed above.

Now as we done with CI and CI relationship understanding now let's understand that how
we can create the CI's relationship in cmdb and see the kind of relationship relationship CI's
have.

How to Create CI Relationship in ServiceNow ?

Below are the steps, from where we will create the CI from the scratch and then create a
relationship between the two CI's in cmdb servicenow.

Steps 1: Let's create the new CI in Server->Window class

 Type configuration in left filter navigator and then navigate to server and then find
window.
 Click on Window
 Click on New Button
once you click on new button you will find below form, fill some information on fields
displayed in the form. Refer below image for the same.
CI Record in ServiceNow

Now save the record. In this way you have the created the CI record under window CI class.

Step 2:

Once you save the CI record, scroll little down, you will find option in related item section
as mentioned in below image:

Add CI Relationship in ServiceNow

Click on the add relationship icon as mentioned above.

Step 3:

 Once you clicked on that icon, you will navigate to relationship editor page. Where
you can select the relationship type and also do filter to find out the required CI from whom
you want to create a selected relationship.
 Scroll little down, now you can select the required CI as per as the filter applied by
you.
 After selecting the CI click on addition symbol to add CI in relationship list as
mentioned in below images.

CI Relationship Editor in ServiceNow

CI Relationship editor in ServiceNow


CI Relationship Editor in ServiceNow

Now click on save or save and exit button. In this way CI relationship between two CI can
be created. A CI can have relationship with multiple CI's.
Now Let's see...

How to Identify the existing relationship between CI in ServiceNow?

To identify the relationship a CI's have, we have to follow below steps:

Step 1: Navigate to any CI Class and open any existing CI record, whom relationship you
have to check.

For e.g.
Navigate to Server --> Window--> open any existing CI --> here i am going to open the
CI, which we have created above.

scroll little below in related item you will the relationship we have created such as Runs
and Used by. Here in related list L1 is First line support and L2 is second line support.
Step 2: Now click on dependency view icon as displayed in above image. Once you clicked
you will find the hierarchy tree where you can see the relationship a CI have with other CI's.

So in this way we can find the relationship between the CI's.

Now let's see that...


Why CI relationship in ServiceNow is required ?

I think from the above example we can come into conclusion that CI relationship in
cmdb provide the visibility that which IT resource are using which IT resource and what
kind of dependency they are having. What all total IT resources a company have, It also tells
about the availability of assets and also tells what action need to be performed in future so
that the business services will not get impacted.

Service Mapping ServiceNow | Briefs of ServiceNow Discovery

ServiceNow CMDB is an ServiceNow ITSM application and one of most usable application
in most of the organization. There are lots of concepts in CMDB which we all want to
explore such as CI, CI Relationship, Service Mapping ServiceNow, Discovery etc. So lets
see what all will be discussed in this article.
In this article we will discuss about below points:

 What is service mapping in ServiceNow?


 Types of service mapping discovery ?
 What is the difference between the bottom up(horizontal) and top down service
mapping (vertical)?
 Where the application services stored which is discovered by service mapping
ServiceNow ?
 For what Service Maps of service mapping is used?
 What is ServiceNow CMDB data identification and data reconciliation?

Service Mapping in ServiceNow:

Let’s consider in an organization there are some application services such as organization
email system, organization Web application, Microsoft Exchange, Performance Monitoring
Application, Microsoft SharePoint, Service Proxy, Data storage, Networking, Information
Security, SAP application etc. and these application services are using some devices,
software applications, servers, hardware, licenses etc.
Now, the question is that what service mapping in CMDB will do in ServiceNow.

So, the answer is that service mapping in ServiceNow will discover all the Application
Services available in an organization for e.g. organization email system, organization
website, networking, data storage etc. and then through top-down mapping approach or
method. Service mapping in servicenow will build a comprehensive map of all the devices,
servers, network devices and configuration profile used in those application services. In other
words, we can say that Service Mapping in ServiceNow maps dependencies, based on a
connection between devices and applications.

This comprehensive map will show CI’s and the relationship in the application service. All
the application services which is discovered by service mapping cmdb will be stored
in (cmdb_ci_service_discovered) table.
We can use Service Mapping in cmdb only when discovery in ServiceNow is activated and
set up. To discover application services and devices, cmdb service mapping relies on
discovery and mid server. Service mapping uses the results discovered and uses MID Servers
to communicate with CIs in an organization. CMDB service mapping creates service maps
and creates a CI in the cmdb representing a business service.

If you are using your personal developer instance, you can type service mapping on the left
side filter navigator. Please find the below screenshot of the same:

service mapping servicenow Picture


Doing Service Mapping set up in servicenow is really a very responsible job. As there lots of
other component which must be installed and set after the service mapping plugin is
activated.

Service mapping discovery is of two types:

 Pattern Based Discovery


 Traffic Based Discovery

Pattern are used to identify applications, properties of the application and connections to
other application. For e.g. there is a pattern of web applications which is used to find web
applications. CMDB service mapping uses patterns to discover and map ci's in cmdb.

Those applications which cannot be identify using pattern, service mapping discovery uses
traffic based discovery to identify those applications.
To perform traffic based discovery service mapping in servicenow uses traffic based
connection to collect network statistics. Traffic based discovery is used at initial stage and it
creates more inclusive map.

There are some questions which comes in mind when we talk about
discovery in cmdb, service mapping in cmdb are as mentioned below:

What is the difference between the Discovery (Bottom-up/horizontal


approach) and Service Mapping (top-down/Vertical approach)?

What I understand is that discovery focuses on Infrastructure and Service Mapping in cmdb
focuses on Business Services. If we elaborate it, then we can say that discovery discovers all
the infrastructure and application, but it does not relate anything to business services but on
the other hand service mapping in cmdb discovers only those applications and infrastructure
which directly supporting a business service and then map their relationships too, so it means
that Service Mapping in servicenow is more precise than of discovery.
Where the application services stored which is discovered by Service
Mapping in servicenow and for what ‘Service Maps’ are used?

Application services discovered by Service Mapping cmdb is stored in


(cmdb_ci_service_discovered) table. Service Mapping creates service map which is used for
impact analysis in change management and incident management.

What is servicenow cmdb data Identification and Data Reconciliation ?

Data coming from different sources can be of two types such as structured data or
unstructured data. Structured data which can be easily identified and unstructured data which
is unmanaged and difficult to identified. So, Data identification is a process which is used to
identify the data and also perform data analysis whereas Data reconciliation is a verification
process through which target data is compared with the source data.

In ServiceNow CMDB ci can be created or updated through different sources such as


manually, CMDB discovery, import sets, event management etc. So, ServiceNow CMDB
data identification and data reconciliation help to maintain the integrity of the ServiceNow
CMDB.

ServiceNow Date Difference Scenario's and Code Solutions


Table of Content:
 ServiceNow get current date (ServiceNow Today's Date)
 ServiceNow get current year
 End Date should not greater than start date in ServiceNow (ServiceNow Date
Comparison)
 Date should not greater than of 10 days from the current Date (ServiceNow Date
Difference Scenario)
 Date should not smaller than of 5 days From Current Date (ServiceNow Date
Difference Scenario)
 Java Script Functions we can use for Date Related Requirement
ServiceNow Get Current Date (ServiceNow Today's Date):
Below is the syntax you can directly use in your onload client script to get the current date in
servicenow:

var startDate=new Date().getFullYear()+'-'+("0"+(new Date().getMonth()+1)).slice(-2)+'-'+


("0"+new Date().getDate()).slice(-2);
g_form.setValue('your field name',startDate);

ServiceNow Get Current Year

Below is the syntax through which you can directly get the current year

var currentYear=new Date().getFullYear();


alert(currentYear);

Date should not greater than of 10 days from the current Date (ServiceNow Date Difference
Scenario):

Below is the code, which we have implemented on onChange() client script. Where user can
only select the dates in-between today and till the 10 days from today. Means user can select
date in the range between today to till 10 future days.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {


if (isLoading || newValue === '') {
return;
}

// Below code will return date in '2021-09-08' format (ServiceNow Date Format)
var startDate=g_form.getValue('u_start_date');

//Below is only for understanding and below code will return date in 'Wed Sep 08
2021 08:56:21 GMT+0530 (India Standard Time)-(Java script date format)' you can
uncomment same and see the result in alert box.

// var javaScriptDate=new Date();


// alert (javaScriptDate);

//Acutally we need javascript date in ServiceNow date format means like '2021-09-08'
so for that we have used below syntax

var currentDate=new Date().getFullYear()+'-'+("0"+(new Date().getMonth()


+1)).slice(-2)+'-'+("0"+new Date().getDate()).slice(-2);
alert(startDate);
alert(currentDate);

//Through this actually we are converting '2021-09-08' to 'Wed Sep 08 2021 08:56:21
GMT+0530 (India Standard Time)'
var stDate=new Date(startDate);
var curDate=new Date(currentDate);

// The time difference is actually calculated in milliseconds. The getTime() method


returns the number of milliseconds and the internal clock in JavaScript starts at midnight
January 1, 1970, so the calculation of milliseconds for a date is calcualted from midnight
January 1, 1970 to current date selected in the field.

var timeDifference=stDate.getTime()-curDate.getTime();
alert(timeDifference);

// The below formula will convert the milliseconds in Days.

var dayDifference = timeDifference / (1000 * 60 * 60 * 24);

if(startDate<currentDate)
{
alert("You can only select date from today’s till 10 days from today");
g_form.setValue('u_start_date','');
}

if((startDate>currentDate) && (dayDifference>10))


{
alert("You can only select date from today’s till 10 days from today");
g_form.setValue('u_start_date','');
}

Date should not smaller than of 5 days From Current Date (ServiceNow Date Difference
Scenario):

Let's assume the ServiceNow date requirement is where user can only give past date in the
field but the restriction is that he can only enter the date till last 5 days not smaller than that
and even he cannot enter the current date. Then you can use below code. You can modify the
code as per your requirement lets says for 90 days, 30 days etc. The only thing you have to do
is that you have to modify the conditions:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {


if (isLoading || newValue === '') {
return;
}

// Below syntax will return date in '2021-09-08' format (ServiceNow Date Format)
var startDate=g_form.getValue('u_start_date');

//Below is only for understanding and below code will return date in 'Wed Sep 08
2021 08:56:21 GMT+0530 (India Standard Time)-(Java script date format)' you can
uncomment same and see the result in alert box.

// var javaScriptDate=new Date();


// alert (javaScriptDate);

//Acutally we need javascript date in ServiceNow date format means like '2021-09-08'
so for that we have used below syntax

var currentDate=new Date().getFullYear()+'-'+("0"+(new Date().getMonth()


+1)).slice(-2)+'-'+("0"+new Date().getDate()).slice(-2);

alert(startDate);
alert(currentDate);

//Through this actually we are converting '2021-09-08' to 'Wed Sep 08 2021 08:56:21
GMT+0530 (India Standard Time)'
var stDate=new Date(startDate);
var curDate=new Date(currentDate);

// The time difference is actually calculated in milliseconds. The getTime() method


returns the number of milliseconds and the internal clock in JavaScript starts at midnight
January 1, 1970, so the calculation of milliseconds for a date is calcualted from midnight
January 1, 1970 to current date selected in the field.

var timeDifference=stDate.getTime()-curDate.getTime();
alert(timeDifference);

// The below formula will convert the milliseconds in Days.

var dayDifference = timeDifference / (1000 * 60 * 60 * 24);

// You can change the conditions as per your requirement

if(startDate>currentDate)
{
alert("You have to enter past date till 5 days from today");
g_form.setValue('u_start_date','');
}
if((startDate<currentDate) && (dayDifference<(-5)))
{
alert("You have to enter past date till 5 days from today");
g_form.setValue('u_start_date','');
}

// If you want that user can enter current date in servicenow form than you can remove the
below if condition
if(dayDifference==0)
{
alert("You have to enter past date till 5 days from today");
g_form.setValue('u_start_date','');
}

End Date should not greater than start date in ServiceNow (ServiceNow Date Comparison):

Below is the code to compare the dates in servicenow. Date comparision is very simple.
Mostly the date comparison is done between two dates for e.g., User should not select date
greater than start date etc.
Below in onchange client script on field end date. means when user change the end date than
this code will run. you can change your field name in place of u_start_date and u_end_date as
per your requirement.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {


if (isLoading || newValue === '') {
return;
}

var startDate=g_form.getValue('u_start_date');
var endDate=g_form.getValue('u_end_date');
if(startDate>endDate)
{
alert("Please select date greater than of Start Date");
g_form.setValue('u_end_date','');
}

Java Script Functions we can use for Date Related Requirement:

As you have already checked above code examples. Below are the very basic java script
functions we can use while working on ServiceNow dates requirements.
 getDate(); //The getDate() method returns the day of the specific month (from 1 to
31)
 getFullYear(); //getFullYear() method returns the year. for e.g., 2021.
 getMonth(); // The getMonth() method returns the month (from 0 to 11). Means
January is 0 and December is 11
 var currentDate=new Date(); //JavaScript uses the browser's time zone and display a
date as a full text string for e.g. '2021-09-08' to 'Wed Sep 08 2021 08:56:21 GMT+0530
(India Standard Time)'

Solution: Remove Item from the Array

// Remove only single item 5 from below array


var arr=[1,4,6,5,9];
arr.splice(arr.indexOf(5),1); // syntax arr.indexOf(5) finds out
that where is 5
located means at which position in the array. and paramater 1 says
that remove
only that single item.
gs.info(arr); // displaying the array after removing.

Solution: Remove Specific item which occurs number of times in an


Array

// Remove all the item 5 from the array


var firstArray=[5,5,3,5,8,5,9,5,4,5,9,5];
for(var i=0;i<=firstArray.length;i++){
if(firstArray.indexOf(5)!=-1){
firstArray.splice(firstArray.indexOf(5),1);
}
}
gs.info(firstArray);
Solution: Remove Duplicate item from an Array

var dupValArray=[1,3,5,7,9,5,7,5,10,24,54,5];
var arrayUtil= new ArrayUtil(); // ServiceNow Out of the Box API.
gs.info(arrayUtil.unique(dupValArray));

Solution: Find out number of times same Value Appears in JavaScript


Array

// Lets say there is a requirement, that we have to find count of any


specific
item in an array.

findReqElementCount(5); // In function we are passing the parameter


as 5, which
says that we have to count the item 5 occurrence in an array.

function findReqElementCount(value){
var occArray=[1,3,5,7,9,5,7,5,10,24,54,5];
var count=0;
for(var i=0;i<=occArray.length;i++){
if(occArray[i]==value){
count++;
}
}
gs.info(count);
}

GLIDEAGGREGATE | Count, Min, Max, Sum, Avg Examples

What is GlideAggregate?

GlideAggregate is a class in ServiceNow that provides a way to perform aggregate functions


on a specified set of records. It works similarly to the SQL GROUP BY clause, allowing you
to group records based on one or more fields and apply functions like COUNT, SUM, AVG,
MAX, MIN, GROUP_CONCAT, GROUP_CONCAT_DISTINCT, STDDEV on the grouped
data. GlideAggregate can be used in server-side scripting such as business rules, script
includes, scheduled jobs or UI actions.
Advantages of using GlideAggregate

Using GlideAggregate instead of traditional methods such as looping through all records and
performing operations on each one has several advantages. Here are a few of them:

Performance: GlideAggregate performs much faster on large data sets than looping through
each record because it only retrieves the data required for the query.

Reduced memory usage: GlideAggregate uses less memory than traditional methods
because it retrieves only the required data for the query.

Improved readability and maintainability: GlideAggregate code is usually shorter and


more readable than traditional methods because it uses simpler syntax and eliminates the
need for complex loops and conditional statements.

How to use GlideAggregate

To use GlideAggregate, you need to create a new instance of the class and specify the table
and fields you want to query. You can then apply grouping and aggregate functions to the
data. Here is an example of a GlideAggregate query that retrieves the number of incidents
created per day in the last week:

var count=new GlideAggregate('incident');


count.addAggregate('COUNT');
count.groupBy('category');
count.query();
while(count.next()){
gs.info(count.getDisplayValue('category')+' - '+count.getAggregate('COUNT'));
}

In this example, we create a new instance of GlideAggregate for the incident table, add the
COUNT aggregate function to the sys_created_on field, group the data by the sys_created_on
field, add a query to retrieve only the last 7 days of data, and then execute the query. Finally,
we loop through the results using the next() method and retrieve the aggregate value and the
sys_created_on field value for each group.
GlideAggregate Aggregation Examples:

The GlideAggregate class provides several aggregate functions that you can use to calculate
values like COUNT, SUM, AVG, MAX, and MIN. In this blog post, we will explore each of
these functions and how they can be used in your ServiceNow instance.

COUNT

The COUNT function returns the number of records in the group. For example, if you want to
know how many incidents were created in the last week, you can use the COUNT function to
count the number of incidents that were created. Execute the below script in background
script and check the output.

var count=new GlideAggregate('cmdb_ci');


count.addAggregate('COUNT');
count.query();
while(count.next()){
gs.info(count.getAggregate('COUNT'));
}

SUM

The SUM function returns the sum of the values in the group. For example, if you want to
know the total amount of time spent on incidents in the last week, you can use the SUM
function to add up the time spent for each incident. Execute the below script in background
script and check the output.

var count=new GlideAggregate('cmdb_ci');


count.addEncodedQuery('manufacturer=b7e9e843c0a80169009a5a485bb2a2b5');
count.addAggregate('SUM','cost');
count.setGroup(false);
count.query();
while(count.next()){
gs.info(count.getAggregate('SUM','cost'));
}
AVG

The AVG function returns the average value of the group. For example, if you want to know
the average resolution time for incidents in the last month, you can use the AVG function to
calculate the average resolution time. Execute the below script in background script and
check the output.

var count=new GlideAggregate('cmdb_ci');


count.addAggregate('AVG','cost');
count.setGroup(false);
count.query();
while(count.next()){
gs.info(count.getAggregate('AVG','cost'));
}

MAX

The MAX function returns the maximum value in the group. For example, if you want to
know the highest priority of incidents in the last week, you can use the MAX function to find
the incident with the highest priority. Execute it in background script and check the output.

var count=new GlideAggregate('cmdb_ci');


count.addEncodedQuery('manufacturer=b7e9e843c0a80169009a5a485bb2a2b5');
count.addAggregate('MAX','cost');
count.setGroup(false);
count.query();
while(count.next()){
gs.info(count.getAggregate('MAX','cost'));
}

MIN

The MIN function returns the minimum value in the group. For example, if you want to know
the lowest priority of incidents in the last week, you can use the MIN function to find the
incident with the lowest priority. Execute the below script in background script and check the
output
var count=new GlideAggregate('cmdb_ci');
count.addQuery('cost','!=','0');
count.addEncodedQuery('manufacturer=b7e9e843c0a80169009a5a485bb2a2b5');
count.addAggregate('MIN','cost');
count.setGroup(false);
count.query();
while(count.next()){
gs.info(count.getAggregate('MIN','cost'));
}

GROUP_CONCAT

GROUP_CONCAT will concatenates all non-null values of the group in ascending order and

joins them with a comma (',') and returns the result as a String. Below is the example of the

same execute it in background script and check the output.

var incidentGA = new GlideAggregate('incident');


incidentGA.addAggregate('GROUP_CONCAT', 'category');
incidentGA.setGroup(false);
incidentGA.query();
while (incidentGA.next()) {
gs.info('GROUP_CONCAT: ' + incidentGA.getAggregate('GROUP_CONCAT', 'category'));
}

GROUP_CONCAT_DISTINCT

GROUP_CONCAT_DISTINCT will concatenates all non-null values of the group in

ascending order, removes all the duplicates and joins them with a comma (',') and returns the
result as a String. Below is the example of the same execute it in background script and check

the output.

var incidentGA = new GlideAggregate('incident');


incidentGA.addAggregate('GROUP_CONCAT_DISTINCT', 'category');
incidentGA.setGroup(false);
incidentGA.query();
while (incidentGA.next()) {
gs.info('GROUP_CONCAT_DISTINCT: ' +
incidentGA.getAggregate('GROUP_CONCAT_DISTINCT', 'category'));
}

STDDEV

STDDEV populates standard deviation. Execute the below script in background script and

check the output. Currently, I am not sure about the use case scenarios for the same but soon I

will be posting the use case scenario of STDDEV.

var test=new GlideAggregate('incident');


test.groupBy('category');
test.addAggregate('STDDEV','sys_mod_count');
test.query();
while(test.next()){
gs.info(test.getDisplayValue('category')+' -
'+test.getAggregate('STDDEV','sys_mod_count'));
}

The GlideAggregate class provides several aggregate functions that you can use to perform
calculations on a set of records. By using these functions, you can calculate values like
counts, sums, averages, maximums, and minimums. Whether you are a developer or an
administrator, understanding the capabilities of GlideAggregate functions can help you make
the most of your ServiceNow instance.

Example and Understanding of GlideAggregate Functions:

The GlideAggregate class in ServiceNow provides several functions that can be used to
perform aggregate calculations on a set of records. These functions can be used to calculate
values like COUNT, SUM, AVG, MAX, and MIN. In this blog post, we will explore each of
these functions in detail and provide examples of how to use them in your ServiceNow
instance.

addQuery()

The addQuery() function is used to add conditions to the GlideAggregate query. It takes two
or three parameters (when we use operators).The field to be queried
The operator for the query (e.g., '=', '>', '<', '>=', '<=', '!=', 'IN', 'NOT IN', etc.)
The value to be compared against
Example: Execute it in background script and check the output.

var count=new GlideAggregate('cmdb_ci');


count.addQuery('cost','!=','0');
count.addEncodedQuery('manufacturer=b7e9e843c0a80169009a5a485bb2a2b5');
count.addAggregate('MIN','cost');
count.setGroup(false);
count.query();
while(count.next()){
gs.info(count.getAggregate('MIN','cost'));
}

addAggregate()

The addAggregate() function is used to add an aggregate function to the GlideAggregate


object. It takes two parameters. The aggregate function to be used (e.g., COUNT, SUM,
AVG, MAX, MIN, etc.)
Example: Execute it in background script and check the output.
var count=new GlideAggregate('cmdb_ci');
count.addQuery('cost','!=','0');
count.addEncodedQuery('manufacturer=b7e9e843c0a80169009a5a485bb2a2b5');
count.addAggregate('MIN','cost');
count.setGroup(false);
count.query();
while(count.next()){
gs.info(count.getAggregate('MIN','cost'));
}

addEncodedQuery()

The addEncodedQuery() function is used to add an encoded query string to the


GlideAggregate object. An encoded query string is a URL-encoded string that represents a
query condition in ServiceNow. It takes one parameter:
Example: Execute it in background script and check the output.

var count=new GlideAggregate('cmdb_ci');


count.addEncodedQuery('manufacturer=b7e9e843c0a80169009a5a485bb2a2b5');
count.addAggregate('MIN','cost');
count.setGroup(false);
count.query();
while(count.next()){
gs.info(count.getAggregate('MIN','cost'));
}

query()

The query() function is used to execute the GlideAggregate query. Once executed, the
resulting records can be iterated over using the next() function.
Example: Execute it in background script and check the output.

var count=new GlideAggregate('cmdb_ci');


count.addQuery('cost','!=','0');
count.addEncodedQuery('manufacturer=b7e9e843c0a80169009a5a485bb2a2b5');
count.addAggregate('MIN','cost');
count.setGroup(false);
count.query();
while(count.next()){
gs.info(count.getAggregate('MIN','cost'));
}

next()

The next() function is used to iterate over the resulting records of the GlideAggregate query.
It returns true if there are more records to be processed.
Example: Execute it in background script and check the output.

var count=new GlideAggregate('incident');


count.addAggregate('COUNT');
count.query();
while(count.next()){
gs.info(count.getAggregate('COUNT'));
}

getAggregate()

The getAggregate() function is used to retrieve the value of an aggregate function for the
current record. It takes one or two parameters. The aggregate function to retrieve (e.g.,
COUNT, SUM, AVG, MAX, MIN, etc.)
Example: Execute it in background script and check the output.

var count=new GlideAggregate('incident');


count.addAggregate('COUNT','category');
count.query();
while(count.next()){
gs.info(count.getDisplayValue('category')+' - '+count.getAggregate('COUNT','category'));
}

setGroup(false)

Useful function to set the groupby to false. Below is the example to use the same. Execute it
in background script and check the output.
var count=new GlideAggregate('cmdb_ci');
count.addEncodedQuery('manufacturer=b7e9e843c0a80169009a5a485bb2a2b5');
count.addAggregate('SUM','cost');
count.setGroup(false);
count.query();
while(count.next()){
gs.info(count.getAggregate('SUM','cost'));
}

You might also like