//Credit to: https://servicenowguru.com/system-ui/ui-actions-system-ui/client-server-code-ui-action/ //Onclick: runClientCode(); //Condition: gs.hasRole('itil')&& gs.getUser().isMemberOf(current.assignment_group.toString()) //Client-side 'onclick' function function runClientCode(){ g_form.setMandatory("assigned_to",false); //Call the UI Action and skip the 'onclick' function gsftSubmit(null, g_form.getFormElement(), 'assignToMe'); //MUST call the 'Action name' set in this UI Action }//Code that runs without 'onclick' //Ensure call to server-side function with no browser errors if(typeof window == 'undefined') runBusRuleCode(); //Server-side function function runBusRuleCode(){ current.assigned_to = gs.getUserID(); current.update(); action.setRedirectURL(current); }