How to auto trigger OTP email on validate_multifactor_auth_code page
Import
·
Oct 26, 2022
·
article
Posting this simple solution here. Seen a lot of requests for the OTP Email to be sent out automatically when users are logging in to ServiceNow
UI Script - AutoEmailOTP
addLateLoadEvent(function(){
setTimeout(function(){
var windowLoc = top.window.location;
console.log('validating window..,');
if(windowLoc.href.includes("validate_multifactor_auth_code")){
console.log('window validated, triggering onClick...');
multifactorSendOneTimePassword();
}
}, 1000); //1 second delay
});
Notes:
- Feel free to remove the console.log() lines
- The 1 second delay is necessary to allow window.location.href to change from "navpage.do" to "validate_multifactor_auth_code.do". This may need to increase if some users have particularly slow browsers/PCs.
View original source
https://www.servicenow.com/community/community-resources/how-to-auto-trigger-otp-email-on-validate-multifactor-auth-code/ta-p/2363955