Local user – create account and send password to external user

Bent J_rgensen1
Tera Contributor

Hi,

We have make a Design Flow I San Diego, where we create an account for new users. The creation itself works, but I think we have a problem with the password.

When we update the user field "password" e.g. with 123456 through Design Flow it is not possible to log in, where we get the error “User name or password invalid”, but when we go to the user and manual enter 123456 in the password field, we can log in. Is there anyone who can help?

Regards, Bent

1 ACCEPTED SOLUTION

Aman Kumar S
Kilo Patron

I don't think setting the display value will be allowed in flow designer.

What you might wanna try is to create a custom action,
In which you can pass user's sys_id and the password string as input, and then gliderecord the user record to set the password using setDisplayValue() function in script step within the action.

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

View solution in original post

7 REPLIES 7

Aman Kumar S
Kilo Patron

I don't think setting the display value will be allowed in flow designer.

What you might wanna try is to create a custom action,
In which you can pass user's sys_id and the password string as input, and then gliderecord the user record to set the password using setDisplayValue() function in script step within the action.

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

Thanks Arman,

 

It works with customer script, where I have used the following code:

(function execute(inputs, outputs) {
    var chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxy";
    var string_length = 12;
    var password = '';
            for (var i=0; i<string_length; i++) {
                var rnum = Math.floor(Math.random() * chars.length);
                password += chars.substring(rnum,rnum+1);
        }

  outputs.password = gs.base64Encode(password);
  outputs.plain_text = password;
  
  var gr= new GlideRecord('sys_user');

  gr .initialize();
  gr.user_name = inputs.Email;
  gr .first_name = inputs.FirstName;
  gr.last_name = inputs.LastName;

  gr.user_password.setDisplayValue(password);

gr.insert();
  
  
})(inputs, outputs);

 

Regards, Bent

Awesome!

Glad it worked out for you 🙂

Best Regards
Aman Kumar