Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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

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

 

The user I printed out gives already sysid

Groupname as tried above as sysid

 

Still not working it's not inthe loop

@Nisha30 

Please paste your script here

// Email on table= sc_request
var openedByUser = current.getValue('opened_by');
var grpMbr = openedByUser.sys_id;
//var grpMbr = current.opened_by; gives UNDEFINED
var grp = "Service Desk";

var checkusergrp = new GlideRecord('sys_user_grmember');
checkusergrp.addQuery('user',grpMbr);
checkusergrp.addQuery('group', 'd625dccec0a8016700a222a0f7900d06');
checkusergrp.query();
if(checkusergrp.next())
{
gs.log("<<check IF checkusergrpgroupID<<<"+checkusergrp.user);
gs.log("<<check IF checkusergrpUserID<<<"+checkusergrp.group);
//return true;
}

Yes Thanks it worked now , the issue was due to group SYSid. 

Thanks a lot for helping all of you