Skip to content

Commit 7ea4a2b

Browse files
authored
Use system property as an object to store multiple values and retrieve attributes when needed (#1823)
* Create script.js * Delete Background scripts directory * Create Convert comma separated values in string to columns * Delete Convert comma separated values in string to columns * Create MID Server availability inside MID cluster.js * Create reame.md * Update MID Server availability inside MID cluster.js * Delete Flow Actions/Check MID Servers status inside MID Server cluster directory * Create script.js * Create readme.md
1 parent 55d8b4b commit 7ea4a2b

File tree

2 files changed

+23
-0
lines changed
  • Server-Side Components/Server Side/Use System Property as an Object to Store Multiple Values and Retrieve Attributes When Needed

2 files changed

+23
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
**Create a property as shown below.**
2+
<img width="804" height="219" alt="image" src="https://github.com/user-attachments/assets/6cf04f6c-35f1-49a4-977d-5f85abf8c119" />
3+
4+
**Use JSON.parse to convert it to an object.**
5+
**Handle errors using try-catch and retrieve attributes as required in any server-side configuration.**
6+
Refer script.js file
7+
8+
9+
**Output:**
10+
<img width="947" height="404" alt="image" src="https://github.com/user-attachments/assets/e0fd6ca1-2e83-4c6d-949f-6f6878b51d7a" />
11+
12+
<img width="343" height="103" alt="image" src="https://github.com/user-attachments/assets/fc8a4d4b-6879-4644-bd45-5f039ee5dd65" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var sysProperty = gs.getProperty("multi_value_object");
2+
try {
3+
var out = JSON.parse(sysProperty); //convert string property value to object
4+
for (var key in out) {
5+
if (out[key]) {
6+
gs.info(key + ":: " + out[key]);
7+
}
8+
}
9+
} catch (e) {
10+
gs.info("Failed to parse property: " + e.message);
11+
}

0 commit comments

Comments
 (0)