- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 08:40 AM
Hello,
I have a "Reject" UI Action that I need to display a pop-up for with a comment box. They need to write the reason for the rejection. After they click ok, the rejected comment populates a reason field on the form.
How can I set this up.
I am struggling to follow the example provided by SN Guru:
https://www.servicenowguru.com/system-ui/glidedialogwindow-advanced-popups-ui-pages/
Thanks!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 08:51 AM
Hi,
You can pretty much duplicate the Cancel Change UI Action form the change_request table.
var rejectconfirmDialog;
function loadConfirmDialog() {
var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
rejectconfirmDialog = new dialogClass("change_confirm_cancel", false, 648, 250);
rejectconfirmDialog.setTitle(new GwtMessage().getMessage("Reject Task")); //Modify title to display on popup
rejectconfirmDialog.render();
}
function moveToCancel(notes) {
//g_form.setValue("state",1) Possible to set the state here.
g_form.setValue("work_notes", notes); //Pass reason worknotes to a field
rejectconfirmDialog.destroy();
gsftSubmit(null, g_form.getFormElement(), "UI action name"); // Call UI action to run server script
}
if (typeof window == 'undefined')
setRedirect();
function setRedirect() {
current.update();
action.setRedirectURL(current);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 09:56 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 10:12 AM
Glad it's working 😄
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 10:19 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 10:28 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2020 11:39 AM
So I made a few modifications. I set the state as well. My issue now is the "State" is not setting. Text fields work no problem. The state temporarily changes, but on the reload of the form, the state field reverts back to original:
Here is what I have:
UI Action:
var rejectConfirmDialog;
function loadConfirmDialog() {
var dialogClass = window.GlideModal ? GlideModal : GlideDialogWindow;
rejectConfirmDialog = new dialogClass("incident_confirm_cancel", false, 648, 250);
rejectConfirmDialog.setTitle(new GwtMessage().getMessage("Reason"));
rejectConfirmDialog.render();
}
function moveToCancel(notes) {
g_form.setValue("state", 7);
g_form.setValue("u_reason", notes);
rejectConfirmDialog.destroy();
gsftSubmit(null, g_form.getFormElement(), "reject_incident");
}
if (typeof window == 'undefined')
setRedirect();
function setRedirect() {
current.update();
action.setRedirectURL(current);
}
HTML
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:dialog_notes_ok_cancel
dialog_id="incident_confirm_cancel"
textarea_id="incident_confirm_reason_text"
textarea_label="${gs.getMessage('Reason')}"
textarea_label_title="${gs.getMessage('A reason is required to cancel this incident')}"
textarea_name="incident_confirm_reason_text"
textarea_onkeyup="enableButton()"
textarea_onchange="enableButton()"
textarea_style="height:auto; width: 100%; resize: vertical;"
textarea_title="${gs.getMessage('Enter the reason here')}"
ok=""
ok_action="cancelincident"
ok_id="incident"
ok_title="${gs.getMessage('Cancel incident')}"
ok_type="button"
ok_style_class="btn btn-primary disabled"
incident_title="${gs.getMessage('Close the dialog')}"
/>
</j:jelly>
Client Script:
function cancelincident() {
var textArea = $("incident_confirm_reason_text");
if (textArea)
moveToCancel(textArea.value.trim());
}
(function() {
$("incident_confirm_reason_text").focus();
})();