We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

Assistance parsing AWS Payload

dswider
Tera Contributor

Hi all, I’m trying to parse a payload coming from AWS in ServiceNow, and I need some guidance on how to go about extracting a specific field. The payload looks like this: {
"statusCode": 200,
"headers": {"Content-Type": "application/json"},
"body": "{\"Operation\": \"SAVE\", \"Message\": \"SUCCESS\", \"Item\": {\"rpt\": \"INQ0000001234\", \"userId\": \"Firstname.LastName\", \"sessionID\": \"glide.scheduler.worker.4\", \"cusip\": \"000000001\", \"u_cusip_changed\": \"true\", ..."
}

I’m currently working with this script in my Scripted REST API to extract the field u_cusip_changed and update another table based on its value: 

var cusipChanged = requestBody.u_cusip_changed;
gs.info("Update Case REST cusipChanged: " + cusipChanged);

if (cusipChanged == "true") {
var caseGR = new GlideRecord('x_g_afss_inquiry_inquiries');
caseGR.addQuery('number', rptBody);
caseGR.query();

if (caseGR.next()) {
caseGR.u_cusip_changed = true;
caseGR.update();
}
}



0 REPLIES 0