- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2023 09:31 PM
Good Morning guys,
I have a system property, with multiple keys in it, and each key has multiple values in it, I am hoping if someone can please help me with a script that can fetch the values of the key from the system property.
System Property Name = my_test_property;
These are the values in my system property
{
"Profile1" : "Portal_1","Portal_2",
"Profile2" : "Portal_3","Portal_4",
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2023 10:51 PM
Hi @Nasir1 ,
Will you be able to change your property as below:
{
"Profile1" : ["Portal_1","Portal_2"],
"Profile2" : ["Portal_3","Portal_4"]
}
if yes, then this code might work for you
var prop = gs.getProperty('test_community_property_1'); //give the name of your property
var jsonObj = JSON.parse(prop);
var keyNeeded = 'Profile1'; //give the key you need
var values = jsonObj[keyNeeded];
gs.print(values);
you will get the values as below:
Mark helpful if it helps in Solving your query
Johns M P
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2023 10:51 PM
Hi @Nasir1 ,
Will you be able to change your property as below:
{
"Profile1" : ["Portal_1","Portal_2"],
"Profile2" : ["Portal_3","Portal_4"]
}
if yes, then this code might work for you
var prop = gs.getProperty('test_community_property_1'); //give the name of your property
var jsonObj = JSON.parse(prop);
var keyNeeded = 'Profile1'; //give the key you need
var values = jsonObj[keyNeeded];
gs.print(values);
you will get the values as below:
Mark helpful if it helps in Solving your query
Johns M P
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2023 10:55 PM
Brilliant, thank you so much this is works now.