Looking for simple GlideModal while rejecting the ticket

sai krishna10
Giga Guru

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

1 ACCEPTED SOLUTION

@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);

View solution in original post

3 REPLIES 3

anshul_goyal
Kilo Sage

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

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 

 

else {
     
        gsftSubmit(null, g_form.getFormElement(), 'testing_reject_documents');

}
 
I updated the UI Action name to "testing_reject_documents" but it is not working . Any idea how can I update the state when I click on submit

@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);