When the user account is Locked in user table and if that user tries to send an email

Yougander patel
Tera Contributor

When the user account is Locked in user table  and if that user tries to send an email to any specific email address then user should an get an email stating that your account is locked. 

 

on user table before insert and update 

please verify my code and let me know because the code is not working in bs rule:

 

Condition : current.user_account_locked_out== true

 

(function executeRule(current, previous /*null when async*/) {

var email = current.email;
var subject = "Your account is locked";
var message = "Your account has been locked. Please contact IT to unlock your account.";
gs.eventQueue("email.send", current, email, subject, message);

})(current, previous);

1 ACCEPTED SOLUTION

Hello @Yougander patel ,

What is the issue did you check sys_email table if the email was recieved by the ServiceNow instance.

Please share the screenshot of the email log. so that I can assist you further.

If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact

Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.

View solution in original post

6 REPLIES 6

Hi Nayan ,

 

i Tried by using your tip but its not working 

Steps:

table:sys_eamail

under conditions: UserID.Lockout is true and Recipents startswith my "devinstnace email id" 

created an email template and added and saved it and next 

i created dummy user and given a Gmail account and i make dummy user to be lockout in dev instance

and then i mail to dev instance from my email account but unable to receive notification in return 

Hello @Yougander patel ,

What is the issue did you check sys_email table if the email was recieved by the ServiceNow instance.

Please share the screenshot of the email log. so that I can assist you further.

If my answer solved your issue, please mark my answer as Correct & Helpful based on the Impact

Best Regards,
Nayan Dhamane
ServiceNow Community Rising Star 2023.