System Property key-value not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2025 01:01 AM
Hello Everyone,
I am having a code as---
Type--String
Value--{"1":"One","one"}
Currently, it is not working, any inputs??
Warm Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2025 06:59 AM
Hi @UTSAV KUMAR JAI,
not working, how? 🙂
Can you please be more specific?
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2025 09:43 PM
Hi @UTSAV KUMAR JAI
Please check your key value ie. {"1":"One","one"} object is not valid format. Missing ":" and value for "one"
{'key1' : 'value1', 'key2' : 'value2',.......}
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Thanks and Regards
Krishnamohan Pyneni
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2025 09:49 PM
you want the key name based on value of json?
if yes then do this
1) your JSON is not valid
2) if your property holds this json then update the script as this
var mappingJson = '{"1":"One"}'; // Your valid JSON string
var mapping = JSON.parse(mappingJson); // Convert JSON string to object
// To get the first (and only) key:
var firstKey = Object.keys(mapping)[0]; // This gets "1"
// To get all keys as an array:
var allKeys = Object.keys(mapping); // This gets ["1"]
gs.addInfoMessage("Key is: " + firstKey);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hope you are doing good.
Did my reply answer your question?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader