- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 12:27 AM
Hi All,
I have a system property that has value stored like :
{"US":"United States","CN":"China","CA":"Canada","JP":"Japan"}
I want to access this System property in a script include where the condition needs to be checked as if the Key is 'US', Value should be returned and 'United States'.
Very new to system properties. Could you all please help me how to resolve this?
Thank you.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 12:49 AM
Here is an example using an OOTB System Property with code run in Xplore
System Property Value
{"REPORT" : "book","MAP" : "image","HOMEPAGE" : "home","SURVEY" : "form","ASSESSMENT" : "form","TIMELINE" : "calendar","SCRIPT" : "script","LIST" : "list","DETAIL" : "book-open","NEW" : "add","SEARCH" : "search","LABEL" : "label","HTML" : "script","DIRECT" : "view","NULL" : "help"}
Script
var index = 'REPORT';
var props = gs.getProperty('glide.ui.nav.type_icon_map');
var hashMap = JSON.parse(props); // Add global prefix if in scope
var answer = hashMap[index];
answer;
Output
book
Replace the system property with your own and the appropriate error checking and you should be good.
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 05:51 PM
As the original question has now been answered, can you please mark my question as correct so this question is shown as solved and removed from the unsolved questions list?
Thanks 🙂
Paul
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2023 11:41 AM
Hey The SN Nerd,
Thank you for this one, I have a question though. What if we want to change the value of 'REPORT' as specified in the System Property Value to another value, shall we say for example 'ServiceNow Nerd' instead of 'book'? Can you please write me a script on how to do it? I haven't found one from my days of searching.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 02:51 AM
Hi Paul,
The above solution worked fine for one scenario. Thank You for this. However for one more scenario, I need to get the reverse. Means if I give input as "book", output should be "Report" as per your example and we need to maintain this one System property.
Please let me know how it can be done.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2021 03:45 AM
in the above question scernario only, how to handle the default/another case ?
suppose, I am getting 3 contry code("US":"United States","CN":"China","CA":"Canada","JP":"Japan) via system property whereas 2 other country code via direct script/ source.. (in this case what country code we are getting, should be remain as is)
please suggest... Thanks in advance!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-30-2024 08:57 PM
Easiest way to check the system property is to use Background script
The value of the system property is: 2024-10-01 00:00:00