- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Wednesday
Over the years, I’ve noticed many developers in the ServiceNow Community asking why gs.getProperty() doesn’t work when used inside a client‑callable Script Include, especially when that Script Include is triggered from a Report Filter Condition. 🤔
I faced the same issue a while back and was equally surprised by this limitation — so here’s a clear explanation and the workaround that saved the day! 💡
❗ The Challenge
When a Script Include is client‑callable and is invoked through a report filter condition, the script actually executes on the client side.
This means:
👉 gs.getProperty() ❌ does NOT work in this context
👉 Because gs = server-side GlideSystem
👉 And a client-callable Script Include runs partially on the client, causing gs methods to fail
✅ The Workaround That Works
Instead of using gs.getProperty(), you can:
🔍 Use GlideRecord to query the sys_properties table
Retrieve the property value like this:
var propValue = "";
var grProp = new GlideRecord("sys_properties");
grProp.addQuery("name", "<your_property_name_here>");
grProp.query();
if (grProp.next()) {
propValue = grProp.value.toString();
}
// use this propValue now
This runs perfectly even when executed via a reporting filter condition. ✔️
📊 My Results
❌ Before
Using gs.getProperty() → No result returned
✅ After
Querying via GlideRecord → Property value returned successfully
🎉 Final Thoughts
This is a simple but important detail that can save you hours of debugging.
If you're working with reports + client-callable script includes, avoid gs.getProperty() and go with a GlideRecord lookup instead. 💪
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
