- 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 10:22 PM
This BR will run on which table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 11:54 PM
On your table where requestor will update the comments.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-04-2022 03:52 AM
Hello Shalika,
This seems to be duplicate question similar to How to send mail to approver on ritm if any comment has been made in the ritm by the requestor but still i am pasting same solution here
I am not sure what will be the best approach to implement this requirement in your instance but you can do the following:
1. Create an event in sysevent_register table with Name as sc_req_item.commented.approver and Table as sc_req_item.
2. Create an after update BR on sc_req_item table with condition and script as shown below:
Script Condition: current.comments.changes() && gs.getUserID() == current.requested_for
(function executeRule(current, previous /*null when async*/ ) {
var lastComments = current.comments.getJournalEntry(1);
var approverList = [];
var sysApprovalGR = new GlideRecord("sysapproval_approver");
sysApprovalGR.addEncodedQuery("sysapproval=" + current.getUniqueValue() + "^state=requested");
sysApprovalGR.query();
while (sysApprovalGR.next()) {
approverList.push(sysApprovalGR.getValue("approver"));
}
if (approverList.length && lastComments) {
gs.eventQueue("sc_req_item.commented.approver", current, approverList, lastComments);
}
})(current, previous);
3. Create a notification on sc_req_item table with below details:
Subject: ${number} has been commented by ${requested_for}
in Message field you can put the below content:
You can make changes as per your requirement in email content.
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-04-2022 10:35 PM
Hello Shalika,
Just wanted to check with you, if the above response answered your question. If yes, then please do close this thread/question by marking the appropriate response as correct.
If you still need any further help or guidance on this then please update those on this question.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2022 10:31 PM
Working great, I´ve just added requestor to Users to get notification if any approver would ask for additional info. I also have to set very high number to BR to prevent sending multiple notifications - because we have a special RITM where 15 approvers are generating at one moment.