Send notification only if updated_by is NOT a member of a specific group (or has a specific role)

Marcel H_
Tera Guru

I am looking for a way, perhaps through advanced conditions on an email notification to send only when the person updating the record is not a member of a specific group, or has a specific role.

Basically I have a group that needs to be notified any time a ticket is updated in the Additional Comments, Work Notes or Close Notes fields, but only if it is someone other than members of their group doing the updates. I'd like it to be dynamic rather than a bunch of "Updated by IS NOT X" conditions since group membership does change occasionally, and I don't want to have to update a large number of notifications if that does happen.

Any help is greatly appreciated. Thanks!

1 ACCEPTED SOLUTION

Uncle Rob
Kilo Patron

Sure thing, boss!
Remember, you have more than 1 way to trigger a Notification.  Most commonly people use the condition  builder logic, but that can run out of steam with just a little complexity. 

The other solid option is to make Notifications trigger on an event (go to the Advanced view of the notification form and see that there's a When to Trigger choice list).  So you go to your Event Registry and create a new event for the situation (notify.nonmember.update lets say).

Now you have a business rule capture the conditionality.
"When an incident is updated...." and in your script something like...

var membership = new GlideRecord('sys_user_grmember');
membership.addQuery('user',gs.getUser());
membership.addQuery('group',<sys_id of group in question>);  //(or current.assignment_group if you want scalability)
membership.query();

if (membership.next()){
  return;
} ele {
  gs.eventQueue('notify.nonmember.update',current,parm1,parm2) //you can send 2 parns with each eventQueue call
}

 

Now just build your notification to be fired by the notify.nonmember.update event.

View solution in original post

6 REPLIES 6

Always appreciate some Kunzkeanwesung!

Marcel H_
Tera Guru
Great, this works very well for this exact use case. Thanks!