Home - ben-vargas/servicenow-wiki GitHub Wiki
Welcome to My ServiceNow Notes
I’ve been working with ServiceNow for over 15 years, collecting a variety of scripts, configurations, and best practices across many versions and releases. Over that time, the platform has evolved significantly, and some of the solutions you’ll find here originate from older ServiceNow releases or address challenges that were common long ago.
In bringing this collection online, I’ve leveraged current leading LLMs — ChatGPT o1 and Gemini 2.0 Flash Experimental — to enhance the details, clarify explanations, and update references where possible. As a result, some of the original logic has been revisited, and commentary is more current. However, these are still solutions influenced by older methods and a changing ecosystem.
Please note:
- Historical Context: Some scripts and approaches may date back to earlier versions of ServiceNow, which could mean certain APIs, tables, or methods have changed, been deprecated, or no longer function as expected.
- Evolving APIs and Features: ServiceNow’s growth and continuous improvement mean that more modern solutions or improved platform features might now exist to solve the same problems more elegantly.
- LLM-Assisted Updates: While the text may be polished and some information brought up to a more current standard, LLM assistance may introduce subtle logical changes or assumptions. The code and instructions provided should be thoroughly reviewed.
- Testing and Validation: Always test any solution you find here in a non-production environment. Evaluate whether it still aligns with best practices, platform capabilities, and your instance’s requirements before using it in production.
In Short: This is my personal knowledge stash for ServiceNow. It spans more than a decade of platform evolution and has recently been refined with the help of AI-based language models. While you may find valuable insights, be prepared to adapt, test, and validate solutions against today’s ServiceNow environment to ensure they meet current standards and functional requirements.
ServiceNow Wiki Table of Contents
Section | Title | Description |
---|---|---|
Getting Started & Core Concepts | Home | Introduction and notes about this wiki's content. |
Understanding Catalog Variables in ServiceNow | Overview of catalog variable structure and relationships | |
Self‐Executing Anonymous Functions (IIFEs) in ServiceNow | Usage of Immediately Invoked Function Expressions for JavaScript encapsulation | |
--- | --- | --- |
User Interface & Client-Side Scripting | Creating a Custom Watchlist using AngularJS | Implementation of an interactive watchlist component using AngularJS. |
Dynamic-Hyperlinks-in-Catalog-Items-with-Help-Text | Creation of dynamic hyperlinks in catalog items with conditional URLs. | |
Displaying Related Attachments – Parent, Child, and Sibling | Display attachments from parent, child, and sibling tasks on a form. | |
Forcing Mobile and Tablet UI Experiences for iOS Devices | Forcing mobile/tablet UI for iOS Devices | |
Setting-Catalog-Item-Variables-from-URL-Parameters | Pre-populating catalog variables from URL parameters | |
Using-Session-Client-Data-in-ServiceNow | Store and retrieve session client data for client scripts. | |
Using jQuery.ajax() to Invoke ServiceNow REST APIs | Using jQuery.ajax() for client-side AJAX calls to ServiceNow APIs. | |
Using-XMLHttpRequest-to-Invoke-ServiceNow-REST-APIs | Using native XMLHttpRequest (XHR) to make API calls in ServiceNow. | |
Client‐Side-Data-Backfilling-with-UI-Scripts-and-GlideAjax | Backfill data using a client script, UI Script and GlideAjax. | |
GlideDialogForm-with-Callback-‐-Populating-Reference-Fields | Creating and using popup forms with callbacks for reference fields. | |
--- | --- | --- |
Server-Side Scripting & Automation | Better Logging with GSLog | Using GSLog to control logging output based on system properties. |
Disabling Business Rules and Workflows During Scripted Updates | Temporarily disabling workflows, business rules, and system fields on updates. | |
Generating-Service-Catalog-Requests-Programmatically | Programmatically creating Service Catalog Requests using different methods. | |
Mapping-Catalog-&-Record-Producer-Date-Variables-to-Record-Fields | Mapping catalog date variables to record fields, and handling time zones. | |
Robust-Change-Request-Creation-via-Scripted-REST-API | Using a Scripted REST API to create change requests, with input validation. | |
Setting-Catalog-Item-Variables-from-URL-Parameters | Pre-filling catalog variable values from URL parameters. | |
Using-GlideAjax-with-JSON-in-ServiceNow | Using GlideAjax to make asynchronous calls and handle JSON responses. | |
Using-Business-Rules-and-Client-Scripts-to-Manage-URL-Parameters | Using Business Rules and Client Scripts to handle URL parameters and pre-populate values. | |
Using-Session-Client-Data-in-ServiceNow | Using session client data to avoid server-side calls when possible. | |
Dynamic-Action-Dispatch-with-Script-Includes | Implement dynamic action dispatch for REST calls using Script Includes. | |
Replacing-Inaccessible-APIs-with-Utility-Script-Includes-in-Scoped-Applications | Replacing Inaccessible Global Scope APIs in Scoped Apps Using Script Includes. | |
Working-with-Time-Zones-Using-Moment.js-and-Moment-Timezone | Time zone conversion using Moment.js and Moment Timezone JavaScript libraries. | |
Extracting a Multi‐Line Description from an Email Body | Extract multi-line descriptions from email bodies using regular expressions. | |
Dynamic-Coalescing-with-Transform-Map-Scripts | Implementing dynamic coalescing logic in transform maps. | |
--- | --- | --- |
Data Management & APIs | Enhanced-Attachments-Display-in-ServiceNow | Consolidating and enhancing attachment displays on forms |
Exporting Data (Including Sys ID) | Methods for exporting data (including Sys IDs). | |
Converting-Date-Differences-into-a-Formatted-Duration-String | Converting date/time differences into formatted duration strings. | |
Mapping-Catalog-&-Record-Producer-Date-Variables-to-Record-Fields | Setting dates when creating a record from a Catalog Item or Record Producer | |
Using-GlideFilter-for-Dynamic-Filter-Checks | Utilizing the GlideFilter API to dynamically check filter conditions. |
|
Using-jQuery.ajax()-to-Invoke-ServiceNow-REST-APIs | Using jQuery.ajax() for client-side AJAX calls to ServiceNow APIs. | |
Using-XMLHttpRequest-to-Invoke-ServiceNow-REST-APIs | Using native XMLHttpRequest (XHR) to make API calls in ServiceNow. | |
GlideAjax-with-JSON | Returning data via GlideAjax as a JSON object, and validating the values. | |
Enhanced-Attachments-Display-in-ServiceNow | Displaying attachments from related records, and linking to source records | |
--- | --- | --- |
Navigation & User Experience | Navigation Handlers – Customizing URL Behavior | Creating and using Navigation Handlers to intercept URLs and redirect to new locations based on rules. |
Redirecting to Task Records from Custom URLs | Creating a UI Page that redirects to a task based on a URL parameter. | |
--- | --- | --- |
System Administration & Configuration | Changing a Table’s Parent with GlideTableParentChange | Using GlideTableParentChange to reassign a table’s parent (undocumented API). |
Overriding ServiceNow Form View Inheritance | Prevent unwanted form view inheritance on related records. | |
Restricting Outbound Email Recipients in Non‐Production Instances | Restricting outbound email recipients in non-production ServiceNow instances. | |
Correcting (Editing/Deleting) Comments and Work Notes | Editing and deleting comments and work notes on ServiceNow records. | |
Copying Attachments Between Related Records | Copy new attachments between related records (e.g. Calls and Incidents) without duplication. | |
--- | --- | --- |
Undocumented APIs & Advanced Techniques | Exploring the _search Feature | Exploring the use of _search to dynamically find records based on table form layouts. |
Enhanced-GlideRecord-Performance-with-addExtraField()-in-ServiceNow | Utilizing GlideRecord's addExtraField() method for better query performance. | |
Using GlideFilter for Dynamic Filter Checks | Utilizing the undocumented GlideFilter API to dynamically check filter conditions. |
|
Extending-the-GlideRecord-Prototype | Extending the GlideRecord prototype, including considerations and alternatives. | |
--- | --- | --- |
External Integrations | Scripted-REST-‐-Validating-Date-Formats | Validating date formats in REST APIs using SimpleDateFormat . |
Now Assist for Code Generation – A Comprehensive Primer | Leveraging Now Assist for Code Generation for faster development. | |
--- | --- | --- |
Reference | ServiceNow Email Resources | A link to a ServiceNow documentation resource for Email Management. |
Comparing Dates – Scoped vs. Global Applications | Comparing dates using GlideDateTime methods or getNumericValue() . |
|
Bi‐Directional Comments and Work Notes Synchronization between RITMs and SCTASKs | Synchronizing comments and work notes between RITMs and SCTASKs. | |
Removing HTML Tags from a String Field | Removing HTML Tags from string fields, and backfilling historical data. |