How to Send an email notification to individual group member, if one of the group member approve/reject the request.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-09-2019 03:41 AM
We came with a requirement, When a request is logged it would go for 3 level of approvals (Apprver1 approved, then it should go to Approver2, and so on (we have 5 approvers), which can achieved if we can create a three lever approval in workflow. But we can't amend/change anything in the Workflow.
Our instance is designed for only one level of approval, either a Line manager or a group approval.
Workaround we are thinking is:
So we are going with group approval (total of 5 approves from different teams), everyone should approve, as usual an approval email will trigger to each of the group members as soon the request is logged.
Now, we should send a notification emails (via Business rule/event) to individual group members. Suppose Apprver1 has approved, so I want to send an email to other group members (Apprver2, Appover3 like that we have 5 approvers), saying Apprver1 has approved this request.
Is there any possibility to achieve like this, or any other work-around? Please note we can’t modify the existing workflow.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2019 02:02 AM
Hi Joni,
hope you are doing great? i am here again seeking your help, have a slight modification in the requirement.
1> First, i log a request.
2> Approval goes to Appover 1, once he approves then 4 group approvals will generate.
3> Group 1, 2, 3, 4 all has 2 users each.
Till here its all fine. They can approve all seems fine.
But now need help for this part: i have to notify the groups.
4> Now if any one users from any group approves, i want to send an email to remaining group
members, stating that the Group 1/2/3/4 has approved, its pending with your approval.
i have a After BR written and triggered an event to send the notification. But its not working.
Here is my Code: Need your help
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr= new GlideRecord('sysapproval_group');
gr.addQuery('sysapproval',current.getValue('sys_id'));
gr.addQuery('state',current.approved);
gr.query();
while(gr.next()){
if(gs.getUser().getUserByID(gr.getValue('approver')).isMemberOf("group 1")){
gs.eventQueue("TriggerEvent"); //log event here
}
}
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2019 09:01 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-28-2019 11:03 PM
Hi,
assuming you have written this BR on table sysapproval_group
try making the following changes to the script
- instead of using sysapproval , use 'parent'
- change state to 'approval' and current.approval
ex -
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var gr= new GlideRecord('sysapproval_group');
gr.addQuery('parent',current.getValue('sys_id'));
gr.addQuery('approval',current.approval);
gr.query();
while(gr.next()){
if(gs.getUser().getUserByID(gr.getValue('approver')).isMemberOf("group 1")){
gs.eventQueue("TriggerEvent"); //log event here
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2019 01:17 AM
Hi rad,
I have written the BR on the sc_req_item table. Coz i have to query for the particular item/Requested items in the sysapproval_group table.
If i write the BR on the group approval table then how can i query the particular RITM inside the group approval table.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-29-2019 01:23 AM
`4> Now if any one users from any group approves, i want to send an email to remaining group members, stating that the Group 1/2/3/4 has approved, its pending with your approval.`
shouldnt the BR be on the sysapproval_group table since we are checking after one group has approved.
You can get the sys_id from the parent field