SLA Notifications to different groups based on the SLA %

jmoore
Mega Expert

Hi,

I am trying to send email notifications to different groups based on the SLA %.

- At 50% - send email to assigned to & Group A

- At 75% - send email to assigned to, Group A, & Group B

- At 100% - send email to assigned to, Group A, Group B, & Group C

I am trying to do this by adding Create Events in a new SLA workflow. Is it possible to add a Group to a parameter in a Create Event? If so, how is this done?

find_real_file.png

find_real_file.png

I realize I can create different email notifications and configure them to send to the different groups. But I am trying to stick to 1 email notification that is sent to various groups based on the event parameter.

Thank you!
Jessica

1 ACCEPTED SOLUTION

Joe McCarty1
ServiceNow Employee
ServiceNow Employee

If you know the group based on the task (i.e. assignment group) you could do:



workflow.scratchpad.group1 = current.assignment_group;



If you know it based on some reference like CI:



workflow.scratchpad.group2 = current.cmdb_ci.support_group;



Or if you need to look up by name:



var group = new GlideRecord('sys_user_group');


if (group.get('name','Group A'))


        workflow.scratchpad.group3;



Then to fire off the event it would be:



gs.eventQueue('this.is.an.event', current, workflow.scratchpad.group1 + ',' + workflow.scratchpad.group2, workflow.scratchpad.group3);



Technically, you don't need the scratchpad if you are firing in the script except as a working area.


View solution in original post

4 REPLIES 4

Joe McCarty1
ServiceNow Employee
ServiceNow Employee

When a notification is an event based notification, you can pass sys ids for users and groups on the parameters as comma separated lists and if the notification has the boxes checked to send to parm1 and parm2 it should evaluate and go out.



The current activity has the parm1 and parm2 fields as script fields.   Based on your screenshot you'll probably need to pass it in as something like ${current.assignment_group} (or whatever group field).   If you have to do a look up, then I would suggest doing it in a run script activity and setting a scratchpad variable and then you can either trigger the event with gs.eventQueue in the script or pass ${workflow.scratchpad.variable_name} with whatever list you looked up.



Hope this helps.


Thanks! So it sounds like a run script activity would be best. Is there an easy way to grab the sys_id of a group via the scratchpad?



Thanks!
Jessica


Joe McCarty1
ServiceNow Employee
ServiceNow Employee

If you know the group based on the task (i.e. assignment group) you could do:



workflow.scratchpad.group1 = current.assignment_group;



If you know it based on some reference like CI:



workflow.scratchpad.group2 = current.cmdb_ci.support_group;



Or if you need to look up by name:



var group = new GlideRecord('sys_user_group');


if (group.get('name','Group A'))


        workflow.scratchpad.group3;



Then to fire off the event it would be:



gs.eventQueue('this.is.an.event', current, workflow.scratchpad.group1 + ',' + workflow.scratchpad.group2, workflow.scratchpad.group3);



Technically, you don't need the scratchpad if you are firing in the script except as a working area.


Thanks so much for your help! That worked great.