- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 11:37 PM
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
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2022 01:05 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 11:47 PM
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 11:55 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 11:57 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2022 12:02 AM
first name = Mid
last name = server
user name is autopoluate = cpms.${company}