- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2020 12:27 PM
Hello
I have a UI action when clicked it will change The incident state to assigned and additional comments are mandatory
I am trying to use this below script but having some trouble to show up the UI action if the client is checked so I removed the client check box in the UI action and now its showing in portal . If i click on the UI action can we show alert message and make additional comments mandatory ? and also is there any other way we can show the UI actions in portal without un-checking the client in UI action.
// Client side onclick function
function reopenIncident() {
g_form.hideFieldMsg('comments');
var usrResponse = confirm('Are you sure you want to reopen the resolved incident? If yes, please add Additional Comments to continue.');
if (usrResponse == true) {
g_form.setValue('incident_state', 2);
g_form.setValue('state', 2);
if (g_form.getValue('comments') == '') {
g_form.setMandatory('comments', true);
g_form.showFieldMsg('comments', getMessage('You must add a reason in Additional comments in order to reopen an incident'), 'error');
return false; //Abort submission
}
// Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'reopen_incident'); // MUST call the 'Action name' set in this UI Action
} else {
return false;
}
}
if (typeof window == 'undefined')
serverReopen();
function serverReopen() {
current.incident_state = 2;
current.state = 2;
current.close_code = "";
current.close_notes = "";
current.update();
action.setRedirectURL(current);
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2020 01:33 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2020 01:11 PM
Hi,
you can create simple client script as like below
if (g_form.getActionName() == "back_end_ui_action_name") {
g_form.setMandatory('comments', true);
g_form.addInfoMessage("please fill the comments");
return false; //Abort submission
}
Please mark the answer if it resolves you query or please hit the help button if it helps you