Trying to create UI Action/button within the Service Operations Workspace

kristenmkar
Mega Sage

Good evening! 

 

I am currently trying to a UI Action within the Service Operations workspace - ideally we want the button to appear within the Interaction Form/layout - if a user doesn't exist, we want to give them the ability to click a check boxing denoting that the user "does not exist" - once the checkbox is selected, I would like the button to appear for the user. This has proved to be a bit more difficult than I thought! I created a UI Action within the Interaction table with the below script - work in progress! Basically, once the checkbox is selected stating the user does not exist, we want "Create a User" button/UI action to display on the Interaction - the agent will then fill out the user fields that will appear on the form once the checkbox is selected and these fields will then be used to create the user profile. 

UI Action Script: 

//create new user
var userGr = new GlideRecord('sys_user');
userGr.newRecord();
userGr.setValue('first_name', current.opened_for.first_name);
userGr.setValue('last_name', current.opened_for.last_name);
userGr.setValue('title', current.opened_for.email);
userGr.setValue('phone', current.opened_for.title);
userGr.setValue('email', current.opened_for.phone);
userGr.insert();
action.openGlideRecord(userGr);
 
I am not sure if this is feasible - the issue I am having now is trying to NOT have the button appear until the checkbox is selected - I tried a condition (current.u_user_notfound==true) and also a UI Policy.  So far the quick action seems to work by populating the fields within the service operations workspace!
2 REPLIES 2

Gangadhar Ravi
Giga Sage
Giga Sage

@kristenmkar have you tried unchecking "Show insert" on ui action ? but you still need to save the record to display button.

 

Please mark my answer correct and helpful if this works for you.

Thanks for the info! I was hoping to accomplish this without having to actually save the Interaction first, but I may just have to leave it available initially, and then create a condition within the script to allow it to run when the checkbox is marked True.  I appreciate the info!