Facing issue in the script include json parse

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 06:06 AM
I was facing issue in script include can anyone help me with this
script include:
"1_3":"USD 20",
"1_4":"USD 30" }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 06:17 AM
Have you tried logging 'equityAmount' and see what value it is printing?
Also, try converting the value of the property to string in the parse, if the above log is printing the value.
var amountsMap=JSON.parse(equityAmount.toString());
Regards,
Srikanth B

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 06:26 AM
It was not displaying anything in log table when i use gs.log('equityAmount') and also modifies the var amountsMap=JSON.parse(equityAmount.toString()); nothing displaying in log value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 06:32 AM
@Community Alums
as the equityAmount is empty, parse is failing.
Try this:
var equityAmount = gs.getProperty('sn_hr_core.PromoAmount')? gs.getProperty('sn_hr_core.PromoAmount'): '{}';
Regards,
Srikanth B

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2024 10:36 AM
@Community Alums Please update your system property sn_hr_core.PromoAmount as follows. Make sure that there are no line breaks in the value.
"{\"1_2\":\"USD 10\",\"1_3\":\"USD 20\",\"1_4\":\"USD 30\"}"
Once the property value is fixed, your code will start returning the correct result.
Hope this helps.