ServiceNow JSON Array - access element (alert additional info box)

 sample JSON:

"ProblemDetailsJSON":{ "id":"4466437076xxxxx6_165458010xxxxV2", "rankedEvents":[ { "startTime":1654580100000, "endTime":1654588096958, "entityId":"HOST-6DE08590762xxxxxx", "entityName":"xxxxxx-compute-xxxx-sandbox.internal", "severityLevel":"RESOURCE_CONTENTION", "impactLevel":"INFRASTRUCTURE", "eventType":"CPU_SATURATED", "status":"CLOSED", "severities":[ { "context":"CPU_USAGE", "value":99.99834, "unit":"Percent (%)" } ], "isRootCause":true } ],















how to access the highlighted element in javascript:
(in this example, the payload is stored within the em_alert.additional_info field)

var addInfo = JSON.parse(grAlert.additional_info); var rankedEvents = addInfo.ProblemDetailsJSON.rankedEvents; var isrootcause = rankedEvents[0].isRootCause;






Comments

Popular posts from this blog

GlideRecord setValue

URL link in addInfoMessage