
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2024 11:04 PM
Hi All,
I am looking for a simple GlideModal example to show the comments box for rejection reason when they click on reject button. Anyone has done something like this.
Thanks
Sai Krishna
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2024 12:02 AM
@sai krishna10, I have used the Processing script to update the Justification content on the task work notes:
Processing Script:
if (selection_result == 'submit') {
var taskRef = new GlideRecord("sc_task");
if (taskRef.get(id)) {
taskRef.work_notes = justification;
taskRef.update();
}
}
response.sendRedirect('/sc_task.do?sys_id='+id);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2024 11:31 PM
Hello @sai krishna10,
You can refer to the code below that I used to display the Justification box when the UI action is clicked:
UI Action Script:
function name_of_function() {
var gDialog = new GlideDialogWindow('UI_page_name');
gDialog.setTitle('set_title');
gDialog.setPreference('sysparm_sys_id', g_form.getUniqueValue());
gDialog.render();
}
UI page Script:
<?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:ui_form>
<input type="hidden" name="selection_result" id="selection_result" value=""/>
<input type="hidden" name="id" id="id" value="${RP.getParameterValue('sysparm_sys_id')}"/>
<div>
<table border="0" width="100%">
<tr>
<td>
<label style="color:red">*</label><label>${gs.getMessage('Justification')}$[SP]</label>
</td>
</tr>
<tr>
<td>
<textarea name="justification" id = "justification" mandatory="true" style="width: 286px; height: 59px;"></textarea>
<script>document.getElementById('justification').focus(); </script>
</td>
</tr>
</table>
</div>
<div align="right">
<g:dialog_buttons_ok_cancel ok_text="Submit" ok_title="Submit" ok="return actionOK();" cancel_text="Cancel" cancel_title="Cancel" cancel="return cancel();"/>
</div>
</g:ui_form>
</j:jelly>
Client Script:
function cancel() {
GlideDialogWindow.get().destroy();
return false;
}
function actionOK() {
var textAreaValue = gel('justification').value.trim();
if (textAreaValue == '') {
alert('Please make sure to enter Justification before submitting.');
return false;
}
else {
var c = gel('selection_result');
c.value = 'submit';
return true;
}
}
Please mark my solution as Accepted and Helpful, if it works for you in any way!
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2024 11:58 PM
Hi Anshul,
This is working but when I update the justification and click on submit, it is not updating the justification field.
I updated my client script in UI page to
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-05-2024 12:02 AM
@sai krishna10, I have used the Processing script to update the Justification content on the task work notes:
Processing Script:
if (selection_result == 'submit') {
var taskRef = new GlideRecord("sc_task");
if (taskRef.get(id)) {
taskRef.work_notes = justification;
taskRef.update();
}
}
response.sendRedirect('/sc_task.do?sys_id='+id);