How to fetch system property value and parse

kmrudulanayak
Tera Contributor

I want to write condition script in risk. conditions, table for below 4 combinations where I have system property Change models exempted from risk calculation" with values vendor, standard verify change model to be applied with this property for last 3 rows and another system property change.risk. threshold" which has threshold value as <300:Low, 300 to 750: Moderate, >750:High based on which risk field in the change form should get updated risk score will be pulled from backend field-u.changerisk_score in change request form

 

Need different condition script for 4 records where it verifies for exempted model first and then get threshold values from property and compare it with riskscore on change form and then update risk in change form.

 

200 -High Risk Score-Risk Calculation value is above threshold-High

 

300-Moderate Risk Score

Risk Calculation value is between low and high threshold

 

400-Low Risk Score-Risk Calculation value is below low threshold. Any suggestions?

2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @kmrudulanayak 

 

https://www.servicenow.com/community/developer-articles/system-properties-it-s-usage/ta-p/2300155

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Harshal Aditya
Mega Sage
Mega Sage

Hi @kmrudulanayak - 

Could you please confirm if you are looking to create a JSON property and retrieve in script ?

 

If so you can follow below steps -
 

System Property : Name : Test_Properties

 

Value :

{
"param1":"test",
"param2":"abc"
}

 

I tested below script in the background script :

var prop = JSON.parse(gs.getProperty("Test_Properties"));
gs.log(prop.param1);
gs.log(prop.param2);
 
Result :
*** Script: test
*** Script: abc