59 views

Symptoms


A Scheduled Job "Approval Reminder Notification" that queries the Approvals that are still at Requested State. From there it generates an event "catalog_task_approval_reminder" that triggers a Notification "Pending Approvals Reminder".

On that Pending Approvals Reminder notification there are the following links/references....

Hello ${approver},

Approval for: ${sysapproval}

View the ${sysapproval.sys_class_name}: ${sysapproval.URI_REF}
View the Approval Request: ${URI_REF}

Request: ${sysapproval.number}

Release


Jakarta Patch 8a

Cause


Found that the original script for the Scheduled Job "Approval Reminder Notification" would iterate through the Approvers via the while loop but there was no 'gr.next' within the for loop to iterate and return the other glide records information. It would pull the first glide record and then just reuse it for the rest of the notifications

Resolution


Moving the return section of the for loop into the while loop would return the gr of each requested approval. Which in turn simplified the coding, see the code we used below; 

var arrUtil = new ArrayUtil(); //set up array to find all pending approvals for users 


var gr = new GlideRecord('sysapproval_approver'); 
gr.addQuery('state', 'requested'); 
gr.addQuery('sysapproval.source_table','sc_req_item'); 
gr.orderBy('approver'); 
gr.query(); 

while (gr.next()) { 

gs.eventQueue('catalog_task_approval_reminder', gr, gr.approver.sys_id); 

 

Article Information

Last Updated:2018-06-20 08:29:44
Published:2018-06-20