- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2022 04:20 AM
Hi Guys,
I need help with the following script, not sure why its not working? I have two system properties ignoreclients and ignoreServers, that have few comma separated values, what I am trying to achieve is get the values from both system properties and store them in ignoreClientsServers array which I am going to use in my flow as an output, but when I run the following script I am only getting system property values of one of the properties not both, please help.
var ignoreClientsServers = []
var sysprop = new GlideRecord('sys_properties');
sysprop.addEncodedQuery('nameSTARTSWITHignoreclients^ORnameSTARTSWITHignoreServers');
sysprop.query();
while (sysprop.next()) {
ignoreClientsServers.push(sysprop.value);
}
gs.print(ignoreClientsServers)
Thanks
Nasir
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2022 04:33 AM
Hi,
while pushing into array use toString()
var ignoreClientsServers = [];
var sysprop = new GlideRecord('sys_properties');
sysprop.addEncodedQuery('nameSTARTSWITHignoreclients^ORnameSTARTSWITHignoreServers');
sysprop.query();
while (sysprop.next()) {
ignoreClientsServers.push(sysprop.value.toString());
}
gs.print(ignoreClientsServers);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2022 04:33 AM
Hi,
while pushing into array use toString()
var ignoreClientsServers = [];
var sysprop = new GlideRecord('sys_properties');
sysprop.addEncodedQuery('nameSTARTSWITHignoreclients^ORnameSTARTSWITHignoreServers');
sysprop.query();
while (sysprop.next()) {
ignoreClientsServers.push(sysprop.value.toString());
}
gs.print(ignoreClientsServers);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2022 04:38 AM
Ahhh perfect thank you so much, that worked, Ankur for the rescue once again, thank you so much mate!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2022 04:52 AM
Glad to help.
Please mark response helpful as well.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-12-2022 05:22 AM
done