The CreatorCon Call for Content is officially open! Get started here.

Notification to sent to approver in catalog item

Shalika
Tera Expert

I have catalog item, where I have 3 level of approvals. First is group approval - where the form is approved from any one of the members of the group, then it goes to manager's approval and after that it goes to supervisor approval. If any comment is made by the requestor of the form during approval stage, then the notification should go to the approver.

How can this be done?

1 ACCEPTED SOLUTION

Mahendra RC
Mega Sage

Hello Shalika,

For this requirement you might have already created a notification on the sysapproval_approver table and that notification is getting triggered when the approval record is created. This notification should be triggered based on some event. If the notification is set to execute when the record is created or updated then please make the changes so that the notificaiton gets triggered on an event say for example approval.requested is event name).

Now if the requestor make any comments on the actual record say on RITM for an example. So, in this case I believe you can write a before or after update BR and check if there is any comments updated by requester then you can check if there is any approval record which is in Requested state in sysapproval_approver table for this RITM record. If you find any record then you can trigger the event approval.requested and can pass the sysapproval_approver record and last comments added on RITM.

I am not sure if this will work as I have not tested this.

BR condition: current.comments.changes()

(function executeRule(current, previous /*null when async*/ ) {
    var lastComments = current.comments.getJournalEntry(1);
    var requestItem = new GlideRecord("sysapproval_approver");
    requestItem.addEncodedQuery("sysapproval=" + current.getUniqueValue() + "^state=requested");
    requestItem.query();
    while (requestItem.next()) {
        gs.eventQueue("approval.requested", requestItem, "", lastComments);
    }
})(current, previous);

Please mark my respsone as helpful/correct, if it answer your question.

Thanks

View solution in original post

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

@Shalika 

Would you mind closing your earlier questions by marking appropriate response as correct?

Members have taken their time and efforts in sharing the solution/approach

https://community.servicenow.com/community?id=community_question&sys_id=705ace1edb78991039445ac2ca96...

https://community.servicenow.com/community?id=community_question&sys_id=b0b528a31bffcd14c17111751a4b...

https://community.servicenow.com/community?id=community_question&sys_id=e0d638c7db2bc110770be6be1396...

https://community.servicenow.com/community?id=community_question&sys_id=b0b528a31bffcd14c17111751a4b...

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader