Dynamic Filter Option with gs.getProperty()

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2019 02:14 AM
Hello,
Maybe someone can share some light on this case:
Requirement: Filter the list of incidents (Report on Dashboard) based on assignment group sys_id kept in a system property.
Solution: Create a Dynamic Filter option
Problem: Filter returns empty when gs.getProperty() is used in Script Include.
Script Include code (:
function GetDefaultGroup() {
return gs.getProperty('test.group');
}
Dynamic Filter Option Configuration:
Result:
Additional information:
- Additional information: Checked with hardcoded sys_id in the script include, it works.
- Checked configuration without script include and used gs.getProperty() directly, it does not work.
Anyone has an idea how to solve it?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2019 02:54 AM
This seems like a product issue to me. I removed the getProperty part and replaced with a gliderecord query to sys_properties table and the same script works.
var glideObject = new GlideRecord('sys_properties');
if (glideObject.get('c2715bce1b5508108ed631d7dc4bcb4e')) { //replace the property sys_id
answer = glideObject.getValue('value');
}
So, you can use this as a workaround and contact support for the said issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-25-2019 06:43 AM
Have you checked the system log for script errors? Depending on when they runs the gs (GlideSystem) object may not be defined and you may have to declare one.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2020 06:51 AM
@Lukasz,
I had the same issue (use gs.getProperty in the client callable script include which is used by the dynamic filter), it isn't working. But when I put in the content (value) of the prop in the Script Include (variable with string) it works....
Found this community article....
https://community.servicenow.com/community?id=community_question&sys_id=45d98fe5db5cdbc01dcaf3231f96...
... see comment of khadija at the end - this explains what happens. The only thing is that the workaround from khadija (getting the prop vi GlideRecord) isn't working too (for non-admin users) - seems because of restrictions on ACLs of sys_properties table (read- access is not granted to "non admin" users).
So at all it seems, there is only the possibility to use a variable with the "intended" value of the sys_prop. in the client callable Script Include (which is necessary that the code is executed via a dynamic filter).
Do anybody else have another idea?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-19-2020 10:08 AM
Replacing the gs.getProperty with gliderecord should work. Read ACL does not apply for Gliderecords in script includes as far as I know. Are you sure that your script does not have any other issue?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-14-2021 12:43 PM
Oh my goodness...I wasted so much time trying to get this to work. THANK YOU!!!!