Auto generate Password by using First Name and last name.

Vamshi_ch123
Tera Contributor

Hi I have created a Catalog item where we have a Variable called First name, last name and password I want the password field to update with first two letters of the first name and last name and some random number between 0 to 1. I could see some business rules when record is inserted but can we achieve this by using client script or script include? we have any script for this.

 

Thanks in advance

Regards,

Sravani

3 REPLIES 3

AnubhavRitolia
Mega Sage
Mega Sage

Hi @Vamshi_ch123 

 

You can right same Business Rule login in your 'Script' field of Record Producer also.

 

AnubhavRitolia_0-1665643706182.png

 

Please mark this as correct answer and helpful if it resolved, or mark this helpful if this help you to reach towards solution.

Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023

SanjivMeher
Kilo Patron
Kilo Patron

This can be achieved using an onChange client script on both the first name field and the last name field.

You need 2 onChange Client Script.

First one on the first name, where you need to check if both first name and last name is not empty then take 1st two characters using substring functionality and last 2 characters.

The 2nd client script should be on last name with the same checks

You can generate random number using logic mentioned in the below link

https://www.w3schools.com/js/js_random.asp


Please mark this response as correct or helpful if it assisted you with your question.

Rohitstad
Tera Contributor

Using your first and last name to generate a password might seem like a convenient idea, but it's not the safest practice. Personal information like your name can be easily guessed or found online, which could make your password vulnerable to hacking. It's always best to use a strong, unique password for each account. You can try using an password generator online to create a secure password that's hard to crack. These tools can generate complex passwords that include numbers, symbols, and uppercase and lowercase letters, making them much more secure than anything you could come up with using your name.