- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2024 09:09 PM
Good evening!
I am currently helping to configure the Service Operations Workspace for our organization. To make it easier for the agents, I developed a UI action to create a user from the interaction if they do not exist. My script works fine to create the new user, but I was hoping to find a way to create the user and then link this new user back to the interaction record (so the agent doesn't need to re-select and find the created user). Here is my current UI Action script (I currently have a button to "Create New User" displayed on the interaction form - it is a boolean field that needs to be checked to show the additional fields to fill out to create the user)
Any ideas or am I crazy?
Thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2024 08:19 PM
Hello @kristenmkar
You can get the created user record sys_id like below:
var userGr = new GlideRecord('sys_user');
if (current.u_user_not_found == true) {
userGr.newRecord();
userGr.setValue('first_name', current.opened_for.first_name);
userGr.setValue('last_name', current.opened_for.last_name);
userGr.setValue('user_name', current.opened_for.email);
userGr.setValue('u_employee_type', current.opened_for.u_employee_type);
userGr.setValue('email', current.opened_for.email);
userGr.setValue('title', current.opened_for.title);
userGr.setValue('phone', current.opened_for.phone);
userGr.setValue('u_syscom', current.opened_for.u_syscom);
userGr.setValue('u_edipi', current.opened_for.u_edipi);
userGr.setValue('u_ech_iii', current.opened_for.u_ech_iii);
userGr.setValue('u_business_area', current.opened_for.u_business_area);
userGr.setValue('u_org', current.opened_for.u_org);
userGr.setValue('u_org_code', current.opened_for.u_org_code);
userGr.setValue('u_org_code_title', current.opened_for.u_org_code_title);
userGr.setValue('u_branch_of_service', current.opened_for.u_branch_of_service);
userGr.setValue('u_command_location', current.opened_for.u_command_location);
userGr.setValue('u_remote_user', current.opened_for.u_remote_user);
userGr.setValue('location', current.opened_for.location);
userGr.setValue('department', current.opened_for.department);
var sysID = userGr.insert(); //store the sys_id
current.opened_for = sysID; //assigning the newly created user record sys_id
current.update(); //update the interaction record
} else {
gs.addInfoMessage("You must check " + "'User Not Found' " + "to Create a New User or remove referenced user in Opened For field.");
}
Is it okay for you guys to create user's via script? How do you handle users in your SN instance?
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-19-2024 08:19 PM
Hello @kristenmkar
You can get the created user record sys_id like below:
var userGr = new GlideRecord('sys_user');
if (current.u_user_not_found == true) {
userGr.newRecord();
userGr.setValue('first_name', current.opened_for.first_name);
userGr.setValue('last_name', current.opened_for.last_name);
userGr.setValue('user_name', current.opened_for.email);
userGr.setValue('u_employee_type', current.opened_for.u_employee_type);
userGr.setValue('email', current.opened_for.email);
userGr.setValue('title', current.opened_for.title);
userGr.setValue('phone', current.opened_for.phone);
userGr.setValue('u_syscom', current.opened_for.u_syscom);
userGr.setValue('u_edipi', current.opened_for.u_edipi);
userGr.setValue('u_ech_iii', current.opened_for.u_ech_iii);
userGr.setValue('u_business_area', current.opened_for.u_business_area);
userGr.setValue('u_org', current.opened_for.u_org);
userGr.setValue('u_org_code', current.opened_for.u_org_code);
userGr.setValue('u_org_code_title', current.opened_for.u_org_code_title);
userGr.setValue('u_branch_of_service', current.opened_for.u_branch_of_service);
userGr.setValue('u_command_location', current.opened_for.u_command_location);
userGr.setValue('u_remote_user', current.opened_for.u_remote_user);
userGr.setValue('location', current.opened_for.location);
userGr.setValue('department', current.opened_for.department);
var sysID = userGr.insert(); //store the sys_id
current.opened_for = sysID; //assigning the newly created user record sys_id
current.update(); //update the interaction record
} else {
gs.addInfoMessage("You must check " + "'User Not Found' " + "to Create a New User or remove referenced user in Opened For field.");
}
Is it okay for you guys to create user's via script? How do you handle users in your SN instance?
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 12:39 PM
Thank you! This is so helpful!
To be honest, we are currently setting up our instance (moving from Ivanti SM) and developing our documentation/configurations for agents. So not sure this will be the 'finalized' way we should go for agents to quickly create a user profile once they call in- if you have some better ideas for profile creation, I would love to hear them! (Which I am sure you do!)
Thank you again!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2024 04:15 PM
Hello @kristenmkar
Sorry for the late reply!
Usually most of the customer's handle users via sailpoint or Azure AD.
Not sure in your case. So, that's why asked you.
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2024 01:47 PM
Sorry, one other question for you! Is there a good way to actually populate the values on the form once I update the "opened by" field? I can see that the Opened For is updated to the user, but it doesn't actually display/show within the interaction form. I am thinking possibly a business rule?
Thanks!
Thank you!