User Creation Email with Password Reset Link
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hi community, good day.
I have a requirement: there is a notification set up on the User table. I want that whenever a user is created, the notification should be triggered for that particular user. In that notification, there should be an email script for resetting the password. When the user clicks on it, they should be redirected to the password reset screen where they can set their password.
I am currently using this script on a normal page, but the result is that it redirects me to the login screen instead.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @rah dev ,
I see "login.do" in your URL. What happens when you try this:
var resetLink = baseUrl + "$pwd_reset.do?sysparm_user=" + current.user_name;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hello @rah dev ,
Try calling "pwd_reset.do" directly, that will bypass that login gate and land on the reset page.
i.e :
var resetLink = baseUrl + "pwd_reset.do?sysparm_user=" + current.user_name;
If my response helped mark as helpful and accept the solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
I tried but it is giving me this stuff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
why not use OOTB password reset process?
Take user Directly to password reset (user enters username/email) - no login required
(function runMailScript(current, template, email, email_action, event) {
var baseUrl = gs.getProperty('glide.servlet.uri');
if (!current || current.getTableName() != 'sys_user') {
template.print("Invalid user record.");
return;
}
// FIXED: Direct to password reset (user enters username/email) - no login required [web:102]
var resetLink = baseUrl + "/$pwd_reset.do";
template.print("<p>Dear " + current.name + ",</p>");
template.print("<p>Welcome! Your ServiceNow account has been created.</p>");
template.print("<p>Please click the link below to set your password:</p>");
template.print("<p><a href='" + resetLink + "'>Set Your Password</a></p>");
template.print("<br/><p>Username: <strong>" + current.user_name + "</strong></p>");
template.print("<p>If the link doesn't work, copy-paste: " + resetLink + "</p>");
template.print("<p>If you did not expect this, please ignore.</p>");
template.print("<p>Thank you!<br/>ServiceNow Team</p>");
})(current, template, email, email_action, event);
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader

