- 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 05:57 AM
Hi Shalika,
The comments are stored in sys_journal_field. You can add an after insert business rule to that table. Be sure to set as many conditions for the rule to fire as possible as that table can get busy.
At a minimum you can limit the rule firing to requested items. Within the rule, you can find the relevant item RITM from current.element_id. With that item positioned, You can check if there is a pending approval. If there is, trigger an event that will send a notice to the approver.
Hope that helps.
:{)
Helpful and Correct tags are appreciated and help others to find information faster
:{)
Helpful and Correct tags are appreciated and help others to find information faster
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 06:17 AM
What condition should I specify in the BR, I cannot find the 'item' field in condition

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 08:42 AM
Maybe you could just add the approver to the watch list of the catalogue item during the approval stage (workflow could add the approver prior to the approval step and remove them after), would that do?
- 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