top of page

Experiencing challenges with ServiceNow support?

IKC provides professional, reliable assistance that covers gaps not supported by ServiceNow

and without the high costs of traditional services.

 

Starting from just $1,000

Accessing ServiceNow System Properties on the Client Side: A Complete Guide

Updated: Mar 30


ServiceNow administrators often encounter situations where client-side scripts require access to system properties typically fetched server-side through gs.getProperty(). Unfortunately, there's no direct client-side equivalent. This guide will clearly explain how to securely and effectively access ServiceNow system properties within client-side scripts, outlining verified best practices, common pitfalls, and alternative solutions for different scenarios such as forms, UI pages, and service catalogs.


Understanding the Challenge

When developing ServiceNow client scripts, you may want to leverage global system properties directly in the user's browser. However, gs.getProperty() is a server-side GlideSystem function and not accessible from client scripts. Attempting to call system properties directly from client scripts without the proper approach leads to script errors and performance issues.


Recommended Solutions and Best Practices


Solution 1: Using Display Business Rules and g_scratchpad (Standard Forms)

A popular, reliable, and straightforward method involves using Display Business Rules along with g_scratchpad to pass system properties from the server-side to client scripts. Here’s how to implement this:

  1. Create a Display Business Rule:

    • Navigate to System Definition > Business Rules.

    • Set the rule type to "Display."

    • In the script section, use:

g_scratchpad.my_property = gs.getProperty('my.property');
  1. Access in Client Script:

    • Create or modify a client script to run onLoad:

var myProperty = g_scratchpad.my_property;
alert("System Property Value: " + myProperty);

This method ensures your property is readily available without asynchronous delays.


Solution 2: Using GlideAjax (Service Catalog & UI Pages)

If you're working within Service Catalog items or UI pages, you won't be able to directly leverage Display Business Rules. Instead, use GlideAjax for asynchronous client-server communication:

  1. Create a Script Include:

    • Navigate to System Definition > Script Includes.

    • Set client callable to true:

var FetchProperty = Class.create();
FetchProperty.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    getProperty: function() {
        return gs.getProperty(this.getParameter('sysparm_property_name'));
    }
});
  1. Call GlideAjax from Client Script:

var ga = new GlideAjax('FetchProperty');
ga.addParam('sysparm_name', 'getProperty');
ga.addParam('sysparm_property_name', 'my.property');
ga.getXML(function(response) {
    var propertyValue = response.responseXML.documentElement.getAttribute("answer");
    alert("Property Value: " + propertyValue);
});

This method is asynchronous and maintains responsive UI experiences.


Alternative Consideration: getXMLWait()

While synchronous GlideAjax (getXMLWait()) is available, it's generally discouraged because it can negatively impact page performance. Note that getXMLWait() is deprecated in some contexts and may be blocked by the browser in the future.


Practical Examples

  • Standard forms: Use g_scratchpad for efficient, immediate access to properties such as default configurations or flags controlling form behaviors.

  • Service Catalog items: Use GlideAjax to fetch configuration properties based on user selections dynamically.

  • UI Pages: Implement GlideAjax with careful planning around asynchronous behaviors, ensuring dependent scripts or UI elements load appropriately.


Common Pitfalls

  • Incorrect Use of Display Business Rules: These rules are ineffective in catalog items and UI pages, often leading developers to mistakenly think their scripts aren't functioning correctly.

  • Synchronous Calls (getXMLWait()): While tempting, synchronous calls should be minimized due to their potential impact on application performance.


Conclusion

Effectively accessing ServiceNow system properties on the client side requires thoughtful implementation using Display Business Rules and GlideAjax, depending on your context. By adopting these methods, you enhance script reliability, maintain application performance, and improve user experience. For best practices, leverage g_scratchpad for standard forms and GlideAjax for Service Catalog and UI pages.


Actionable Next Steps

  • Review your client scripts to identify opportunities for optimization.

  • Implement Display Business Rules and GlideAjax based on your scenario.

  • Monitor script performance to continuously refine and improve user interactions.

Experiencing challenges with ServiceNow support?

IKC provides professional, reliable assistance that covers gaps not supported by ServiceNow

and without the high costs of traditional services.

 

Starting from just $1,000

CONTACT

New Zealand HQ

Integrated Knowledge Consulting Office

Level 3, 93 Grafton Road

Auckland

South Korea

Integrated Knowledge Consulting Office

BMY역삼타워 6층

서울특별시 강남구 역삼동 678-10번지

 

info@ikconsulting.com

Thanks for submitting!

  • LinkedIn Social Icon

© Copyright 2025 Integrated Knowledge Consulting. All rights reserved.

bottom of page