- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 12:33 PM
How to set default password to a new user...when the user record inserted for the first time we need to set default password as "Sathwik@"
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 11:36 PM
If you only want to set the default password for the users when you are loading in bulk then no need of Business rule.
you can handle this via onBefore transform script as well
Sample script below:
(function runTransformScript(source, map, log, target /*undefined onStart*/ ) {
// Add your code here
target.user_password.setDisplayValue('Sathwik@');
})(source, map, log, target);
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 01:41 PM
A default password could represent a security risk.
But, you can always have a process on which a temporary new password is set to the new users. I will imagine this can either be done through script or through the action of a support agent and/or admin in the instance.
Users are pulled from LDAP, AD integration.
Do you have AD integration to pull users records?
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 01:55 PM
Yes, It will fixed by script...I tried using business rule but not worked for me...can you suggest how to proceed?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 02:01 PM
Use below script to update default password for users.
You need to update query for returning correct user records.
var usr = new GlideRecord('sys_user');
usr.addQuery('active', 'true');
usr.addQuery('user_name', userid);
usr.query();
while(usr.next()){
var newpw = "test124";
usr.user_password.setDisplayValue(newpw);
usr.password_needs_reset = true;
usr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 02:05 PM
Thanks for your reply,
If I written above script it will update for all records..but what my requirement is whenever the new user record was created then only we need to set default password.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-08-2020 02:23 PM
Use this script in business rule advance section on sys_user table.
Regards,
Sachin