when user is locked out info message is not working when iam using custom script action

pavan104
Tera Contributor

Hi Team,

Iam facing issue, when user is locked out info message is not working when iam using custom script action in servicenow

Below is the script i have used and created system property, logs are working but iam not getting info message, please help me.

 

var maxUnlockAttempts = gs.getProperty("STLA.user.max_unlock_attempt"4);
var grUser = new GlideRecord("sys_user");
grUser.addQuery("user_name", event.parm1.toString());
grUser.query();

if (grUser.next()) {
    grUser.failed_attempts += 1;
    if (grUser.failed_attempts > maxUnlockAttempts) {
        gs.log("User " + event.parm1 + " locked out due to too many invalid login attempts");
        gs.addInfoMessage("Account is locked due too many invalid attempts.");
        grUser.locked_out = true;
        grUser.update();
    } else {
        grUser.update();        
}
}
 
0 REPLIES 0