UI Pop dialog box for rejections comments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2017 06:25 AM
Hi,
I'm working on a UI dialog box that pops up when rejecting an approval, but I have 2 issues which I need assistance on
Issue 1: the pop-up box is on the right hand side and I want to make it central and wider.
Issue 2: I need assistance on updating the current approval form state once clicking OK on the pop up
UI Action and page scripts below:
UI Action:
Onclick: commentsDialog()
script:
function commentsDialog() {
var dialog = new GlideDialogWindow("rejection_comments");
dialog.setTitle("Add Rejection Comments");
dialog.render();
}
UI Page:
HTML:
<g:ui_form>
<!-- Set up form fields and labels -->
<table width="100%">
<tr id="description_row" valign="top" align="center">
<td colspan="2">
</td>
</tr>
<tr>
<td>
<input type="hidden" name="my_sys_id" id="my_sys_id" value="${RP.getWindowProperties().get('sys_id')}"/>
<g:ui_multiline_input_field name="dialog_comments" id="dialog_comments" label=""
value="${jvar_comments_text}" mandatory="true"/>
</td>
</tr>
<tr>
<td colspan="2">
</td>
</tr>
<tr id="dialog_buttons">
<td colspan="2" align="right">
<!-- Add OK/Cancel buttons. Clicking OK calls the validateComments script -->
<g:dialog_buttons_ok_cancel ok="return validateComments()" ok_type="button" cancel_type="button" />
</td>
</tr>
</table>
UI Page Client script:
function validateComments() {
//This script is called when the user clicks "OK" in the dialog window
//Make sure there are comments to submit
var comments = gel("dialog_comments").value;
comments = trim(comments);
if (comments == "") {
//If comments are empty, alert the user and stop submission
alert("Please enter your rejection comments before submitting.");
return false;
}
//If there are comments, close the dialog window and submit them
GlideDialogWindow.get().destroy(); //Close the dialog window
g_form.setValue('comments', comments); //Set the "Comments" field with comments in the dialog
g_form.setValue('state','rejected');
}
Thanks,
Adam

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2017 07:06 AM
Hello Adam,
For Issue 1 -
You need to change the UI Page design using CSS and HTML tags.
For Issue 2 -
g_form.setValue('state','rejected');
Replace the 'rejected' with the value of state REJECTED.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-19-2017 08:35 AM
g_form.setValue('state','rejected'); that bit is fine. but I should be using the processing script to update the whole record. So Ui buttons could disappear and request can move to the next stage

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2017 12:15 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-20-2017 02:02 AM
I already had the condition on the UI action.
Im now using the processing script which I could update the page and set the redirection.
The only problem I now have is updating the comments.