Need to create a flow designer to create user and assign role

Supriya13
Giga Expert

Created a catalog item with variable 

1. Company name > refernce

2. user name > string> autopuplated

3. password > mask type 

Need to create a flow designer to create a new user and assign the role to him. 

 

I start with trigger > service task , also add get catalog variable , and  stuck at action to create a user 

how can I create user and assign role to user

1 ACCEPTED SOLUTION

Hi,

you need to use inline f(x) script to unmask and then set the value for password field

Sample script below

var password = fd_data._1__get_catalog_variables.passwordVariable.getDecryptedValue();
return password;

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

17 REPLIES 17

Ravi Peddineni
Kilo Sage

@Supriya 

 

First of all, I would suggest you to create user manually instead of using a script to do it.  Because that will cause many issues like the password field is 1 way encrypted that means you cannot decrypt it through a script and in future if you use any Okta or Azure for Single signon, That would cause more issues as the ids will not match.

You can just create a task to User Admin team to create a user manually and after the task is completed, You can add roles to user by creating a record in sys_user_has_role table (For this too I would suggest you to add user to Group and give role to the same group instead of directly giving a role to User)

can I use record producer to create a user record and then assign role by runing bussiness rule. 

Password can be get using record producer?

 

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

but what would be the user's first name, last name as you are just having user name

It's possible using flow

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

first name = Mid 

last name = server

user name is autopoluate = cpms.${company}