- 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 12:31 PM
Hi,
Since you have unchecked the Client-Callable checkbox it will not be called Client side & function reopenIncident() is of no use then.
Also, alert can be produced only on client side part. In addition, if you will you can use gs.addErrorMessage() in your code & abort the action in case comments are not filled & provide an Error message stating 'Comments mandatory'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2020 12:47 PM
is there any other way to show the UI actions on portal ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-17-2020 12:57 PM
For portal always recommended to go with Widget approach. If you are looking for step-by-step option then you can refer link for a check.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-18-2020 01:33 PM