Populate CATCH error in a notification
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 02:35 PM
Hello everyone!
im working in a notifcation, fired by an event. This event is fired by a SScedule job.
In the scheduled Job we have a TRY/CATCH to get the error, so I need to populate the error in the body of the notification, bu I´m still getting this error:
In the Scheduled job I have this try/catch:
And this is the notification body:
Any Idea?? Thanks to all.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 03:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 04:27 PM
@James Chun Sure!
var grReqRoleApprovers = new GlideRecord('x_amspi_access');
grReqRoleApprovers.addEncodedQuery('u_iiq_approval_statusISEMPTY^u_request_role_id.active=true');
grReqRoleApprovers.query();
while (grReqRoleApprovers.next()) {
try {
var reqNum = grReqRoleApprovers.u_request_role_id.u_request_id.number.toString();
var jsonApprovalPayload = JSON.parse(grReqRoleApprovers.u_iiq_approval_submission_payload);
// if iiq approval submission payload field has multiple item in it, then push each item to iiqApprovalPayload
for (var x = 0; x < jsonApprovalPayload.length; x++) {
iiqApprovalPayload.push(jsonApprovalPayload[x]);
uniqueNumList.push(reqNum);
}
} catch (error) {
requestDataService.createIntegrationIncident("SN", "N/A", "[My Access Multiple Approval Submissions Queueing Job]: " + error, gs.getUserID());
gs.error("[My Access Multiple Approval Submissions Queueing Job] SN Request Data Service error " + error);
// Send notification when error is catched
gs.eventQueue("x_amspi_my_access.request_approval_submi", grReqRoleApprovers, error.message);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-18-2024 05:53 PM
Hi @Facundo Prado,
Thanks for sharing the script.
A few things that I noticed in the script:
- Undeclared variables - iiqApprovalPayload and uniqueNumList
- Can you verify that the 'u_iiq_approval_submission_payload' field is not empty and it's in JSON string format? The error suggests that it's likely from that.
It looks like you are creating an Incident within the 'catch'. If so, why do you need to trigger another email notification as the Incident will generate its own email notification.
Or is this event for a different type of notification?