- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 05:46 AM
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?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 09:08 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 11:04 PM
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
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader