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

Understanding gs.getProperty in ServiceNow: A Practical Guide

Updated: Mar 29

ServiceNow administrators and developers frequently encounter scenarios requiring dynamic configurations that avoid hard-coded values. The gs.getProperty() function in ServiceNow provides an effective solution by enabling scripts to fetch system property values at runtime. This article clarifies what gs.getProperty() is, its importance, and how it can simplify script maintenance and improve flexibility.


What is gs.getProperty?

The gs.getProperty() method belongs to the GlideSystem API, used server-side to retrieve the value of system properties stored within the sys_properties table. It  always returns property values as strings, even if the stored value is a number or Boolean. Additionally, it allows specifying a default value to be returned if the requested property does not exist.

Example usage:

var apiUrl = gs.getProperty("integration.api.url", "https://default.url.com");

Common Use Cases

  • Integration URLs: Avoid hard-coding URLs by storing them in system properties.

  • Feature Toggles: Dynamically enable or disable features without modifying scripts directly.

  • Thresholds and Limits: Configure numeric or date-based thresholds.


Step-by-Step Guide: Finding Property Values

  1. Navigate to System Properties > All Properties (sys_properties.list).

  2. Search for the exact property name used in your script.

  3. Click on the property to view details and its current value.


Troubleshooting Common Issues

  • Empty Values: Verify the property name is accurate and exists.

  • Boolean Confusion: Always explicitly compare boolean properties (gs.getProperty("prop.name") == "true").

  • Scope Issues: Ensure property names are prefixed correctly, especially in scoped applications.


Practical Examples

Example 1: Email Sender Configuration

var senderEmail = gs.getProperty("glide.email.username");
gs.log("Email sender configured as: " + senderEmail);

Example 2: Using Feature Toggles

if (gs.getProperty("notify.incident.update") == "true") {
  gs.info("Incident update notifications are enabled.");
  // Notification logic here
}

Alternative Approaches

  • Custom Tables: Suitable for managing more complex configurations.

  • Application Properties: Scoped applications might benefit from dedicated modules.

  • gs.setProperty: Used for programmatically managing system properties. (Requires admin privileges and may not take effect immediately due to caching; use gs.flushProperties() if an immediate update is needed.)


Conclusion

Utilizing gs.getProperty() significantly enhances your ServiceNow scripts by promoting maintainability and flexibility. Regularly audit scripts to replace hard-coded configurations with dynamic properties and document each property clearly to facilitate easier management and troubleshooting.

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