User creation via script and sharing credentials

sunilsargam
Tera Guru

hello Team,

 

I’ve created a custom table that extends the sys_user table. A user record is being generated under certain conditions via a Business Rule.

 

Once the user is created, I set a password programmatically and send the login credentials to the user via email.

 

While the password appears to be set successfully, when the user tries to log in through the ESC portal using the provided credentials, they receive an "Invalid credentials" error.

 

Has anyone encountered a similar issue or can offer guidance on this?

Thank you!

9 REPLIES 9

GlideFather
Tera Patron

Hi @sunilsargam 

are they using the correct user name?

Have you tried it for you as well?

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


@sunilsargam let's assume that the password is inserted correctly, the other and only possibility would be the username, which is the User ID (user_name) and this must be strictly unique.

admin in the case below:

KamilT_0-1753282197064.png

 

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Hello @GlideFather ,

 

im writing the below script and in xml i can see this value is populated. but when im trying to login, it is giving me error. 

    var gr = new GlideRecord("customTable");
    gr.get(userSysId);
    var pass = "test";
    gr.user_password = pass; // Set the password field directly
    gr.update();

I guess that the password is evaluated against this value:

Screenshot 2025-07-23 at 15.56.01.png

 

So you nee d to create a user account with the user_password value and that allows them to enter.

 

You can try it first manually:

  •  create a user with user_name "test.password",
  • user_password set to any value you will remember,
  • good practice is to set "password needs reset" to true.

 

Then go to incognito or another browser use the /login.do and try it 

when this passes OK you will need to adjust your script to insert the User to the User table

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */