isMemberOf not working in notification

VuchiV
Tera Contributor

Requirement is not sending a notification in case approver is part of specific group. Please find the code I used in notification advanced condition which is not working it seems. Even if approver part of group mentioned, it is sending the notification. Notification is on Approval[sysapproval_approver] table.

 

script: 

answer =  !(current.approver.isMemberOf('b94fa52553920010f255ddeeff7b12c0'));
 
suggest any changes in code
1 REPLY 1

Tanushree Maiti
Mega Patron

Hi @VuchiV 

 

Simplest way  to do it :

 

Navigate to System Notifications > Email > Notifications.

Open the notification for approval requests (on sysapproval_approver).

In the When to send tab, add a condition:

  • Approver.Group | Is Not | <Name of your Group>

 

Alternatively, use a script in the Advanced condition field:

var isMember = gs.getUser().getUserByID(current.approver).isMemberOf('<Group_sys_id>') ;

answer = !isMember;

 

 

Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin: