Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-20-2022 10:23 AM
You mean like this, yea?
try {
var r = new sn_ws.RESTMessageV2('STP CI Solicitation', 'Default GET');
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
var parser = new JSONParser();
var parsed = parser.parse(responseBody);
gs.info(httpStatus);
for (i = 0; i <= 4; i++) {
// var userVariable = JSON.stringify((parsed.data[i]['attributes']['procurement-official']['user']['first-name']));
var userVariable = JSON.stringify((parsed.data[0].attributes["procurement-official"].user["first-name"]));
gs.info(userVariable);
}
} catch (ex) {
var message = ex.message;
gs.error("This is the ex error message" + message);
}
still get the same error:
*** Script: This is the ex error messageCannot read property "first-name" from null: no thrown error