Email notification advance condition issue

Nisha30
Kilo Sage

Hello Community,

Need help, Trying to create notification on sc_request where we need to restrict email going to user if opened_by for that request belongs to service desk group. 

So normal scenario the email goes with proper condition but when I try applying below advance condition it gives me opend by, group name have printed and checked but somehow 

It is not working from Gliderecord where I am looking if openedBy belongs to Service Desk group.

Can anyone suggest what is wrong.

Thanks 

1 ACCEPTED SOLUTION

Maddysunil
Kilo Sage

@Nisha30 

I think in your code you need to take group sysid instead of group name

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks

 

View solution in original post

13 REPLIES 13

Happy to help you..Keep learning 🙂

Ramz
Mega Sage

Hi @Nisha30 

Try this:

var openedBy= current.opened_by;
var gr = new GlideRecord('sys_user_grmember'); // Table stores the mapping of user and group.
gr.addQuery('user', openedBy); 
gr.addQuery('group', '<sys_id_group>');// replace <sys_id_group> with actual sys_id of Service Desk group.
gr.query();

if(gr.next()){
  answer=false; //do not send email when opened by is part of Service Desk assignment group
}
else{
answer =true;
}

Please mark the answer correct/helpful if it resolved your query.Thanks!

Pasted my script 

Current.opened_by gives undefined 

Hi @Nisha30 ,

current.opened_by should give you the sys_id of the opened by in the form. 

then try to use this :

var openedBy= current.getValue('opened_by');

 Please mark the answer correct/helpful if it resolved your query.Thanks!