Catlog Item

Nareshpatel
Tera Expert

For catalogue items, where line manager approval is there - approach all form owners and inform them that if line manager will not approve ticket within 3 Days/?,  then approval will go line manager's manager which we are going to implement.

Could any one provide   notification conditiion and schedule job script .

1 REPLY 1

ArupM6697488157
Mega Guru

Hi Naresh,

For notification condition, you can send the mail straight away as this notification should be triggered beforehand. If this is not the case and need to trigger the notification while the approval should go to line manager's manager, then you can set send when as Event is fired and can trigger the event from the scheduled job. So additionally in this step you have to create event as well in event registration module.

 

For scheduled job script:

var approverGr = new GlideRecord("sysapproval_approver");
approverGr.addEncodedQuery("state=requested^sys_created_onRELATIVELT@dayofweek@ago@3^sysapproval.ref_sc_req_item.cat_item=<sysid of your catalog item>"); // populate the sys id with your catalog item sysid
approverGr.query();
while (approverGr.next()) {
    if (approverGr.document_id.variables.line_manager == approverGr.approver) {
        approverGr.approver = approverGr.document_id.variables.line_manager.manager;
        approverGr.update();
		gs.eventQueue("<event name>", approverGr.document_id, "<whom to send>", ""); // use this if you want to send the notification for while assigning it to line manager's manager otherwise ignore
    }

}

 

Try this, and let me know if you have any concern