
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2017 09:02 PM
Hi All,
How to copy password from the record producer of user table?
My requirement: I want to create record producer of user table.
I am able to get the all the details from record producer to user but except the password field.
Could any one has faced this type issue?
ServiceNow Commnunity MVP -2018 class.
Solved! Go to Solution.
- Labels:
-
Best Practices
-
Instance Configuration
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-16-2017 09:14 PM
Hello Karthik,
To set the password from the record producer script which is on user table should be like:
current.user_password.setDisplayValue(producer.field_name);
This will create a password from the field value on record producer.
Thanks,
Surya Amara
PS: Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2017 10:00 PM
Hello Sachin,
Thanks for the response,
My bad sorry for the confusing requirement. Actually i want to give a field for the user where the user can set a password of his choice. I want to map this password with the user table password. But when we are mapping this field user is not saving/updating.
We are all to map the field values to the user table except the password .
I am able to do the password validation(password and confirm password).
ServiceNow Commnunity MVP -2018 class.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2017 10:15 PM
I will suggest to explore self service password reset functionality for achieving your requirement.
But, please note that this works for only local user account.
OR
you could use below script in your record producer.Please modify according to your record producer variables.
var newUser = new GlideRecord('sys_user');
newUser.initialize();
newUser.user_name=current.customer_name;
var Encrypter = new GlideEncrypter();
var encryptedPassword = current.u_password;
var decryptedPassword = Encrypter.decrypt(encryptedPassword);
gs.addInfoMessage("decryptedPassword:::"+decryptedPassword); // Am able to see password.
newUser.user_password.setDisplayValue(decryptedPassword);
newUser.insert();
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2017 10:23 PM
Hello Sachin,
It was working fine. But i am not able to login with same password.
ServiceNow Commnunity MVP -2018 class.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2017 10:28 PM
Can you please try below code?
We need to use setDisplayValue method.
This should work.
- var Encrypter = new GlideEncrypter();
- var decrypted = Encrypter.decrypt(current.variables.password);
- var gu = new GlideRecord('sys_user');
- gu.initialize();
- gu.user_password.setDisplayValue(decrypted + '');
- gu.insert();
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-15-2017 10:33 PM
Still the same issue persisting.
I have given variable type masked for the password in record producer.
ServiceNow Commnunity MVP -2018 class.