User not part of group but still receiving notifications.

Ankit69
Tera Contributor

User is receiving notifications for group but he is not part of the group.

Notification is on sn_hr_core_case table. It gets sent when event is fired. Who will receive has Event parm 1 contains recipient checked and Send to event creator checked.

Business Rule is on sn_hr_core_case table. It runs after insert/update on conditions State is Work in Progress and Assigned to is empty.

Following is the BR script, please validate if the script is correct or need any changes. I feel we need to query with group.sys_id as it is reference field.

(function executeRule(current, previous /*null when async*/ ) {
/*en = En = English or (System Default English)*/

var approverGr = new GlideRecord("sys_user_grmember");
approverGr.addQuery('group', current.assignment_group);
approverGr.query();
var approverList = [];
while (approverGr.next()) {
approverList.push(approverGr.getValue("user"));
}
gs.eventQueue("sn_hr_core.hr.case.assigntogroup.En", current, approverList.join(","));
})(current, previous);

@Ankur Bawiskar @Chuck Tomasi 

10 REPLIES 10

Community Alums
Not applicable

i agree with Jaspal 

Community Alums
Not applicable

Hi Ankit,

Check this solution by adding to watchlist :https://community.servicenow.com/community?id=community_question&sys_id=6da24956dbebdc1011762183ca96...

Mark my answer correct & Helpful, if Applicable.

Thanks,
Sandeep

Ankit69
Tera Contributor

@Jaspal Singh @Sandeep Dutta It runs as per below:

find_real_file.png

You can add

Assignment Group | changes

additionally

As this runs on update as well it will be sent always unless you wish to

State | changes to | Wip

along with

Assigned To | is empty

 

Just ensure you pass a condition that is specific not generic like above. As even if there is an update to comment it will send mail if comment is added when state is wip & assignd to is empty.

Hi,

how are the recipients set in notifications?

Is it via eventQueue()?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader