How to get pop up in ITSM Application

Steveanner
Tera Contributor

Hello Community Folks,

@Ankur Bawiskar 

We are using ITSM Applications and we are looking for  pop up window when user click the resolve button

it should display below fields in pop up window 

1.Resloution code(Drop down values also should come)

2.Resulution notes

Note : when popup open we should mandate both fields values if anyone click ok without entering values it should populate error message and also we are looking to include this code in resolve button without breaking existing functionality

We are not experts to achive this can anyone help with code to sort out this it would be appreciated

 

Thanks,

Steve An

1 ACCEPTED SOLUTION

@Steveanner 

here is the sample on how to show choice and update

enhance as per your need

UI Page Name: show_resolution_code_notes

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:ui_form>
		<g:evaluate var="jvar_sysid"
					expression="RP.getWindowProperties().sysid"/> 
		<table border="0" width="100%">
			<tr>
				<td>
					<g:ui_multiline_input_field name="resolution_notes" label="Resolution Notes" mandatory="true" />
				</td>
			</tr>
			<tr>
				<td>
					<g:ui_choice_input_field id="resolution_code" name="resolution_code" label="Resolution Code" onChange="populateChoices()">
						<option value="none">${gs.getMessage('--None--')}</option> 
						<option value="Solved (Work Around)">Solved (Work Around)</option> 
						<option value="Solved (Permanently)">Solved (Permanently)</option> 
					</g:ui_choice_input_field>
				</td>
			</tr>
			<tr>
				<td>
					<g:dialog_buttons_ok_cancel cancel="return onCancel();" ok="return onSubmit();"/>
					<input type="hidden" id="task_sys_id" name="task_sys_id" value="${jvar_sysid}"/>
				</td>
			</tr>
		</table>
	</g:ui_form>
</j:jelly>

Client Script:

function onCancel() {
	GlideDialogWindow.get().destroy();
	return false;
} 

function onSubmit() {

	var data = gel('resolution_notes').value;
	var dropdown = document.getElementById("resolution_code");
	var closeCodeValue = dropdown.options[dropdown.selectedIndex].value;

	var sysId = gel('task_sys_id');
	var app = new GlideRecord("incident");
	if(app.get(sysId)){
		app.close_code = data;
		app.close_code = closeCodeValue;
		app.update();
	}
	window.open('/incident.do?sys_id='+sysId);
}

UI Action:

1) Client checkbox - true

2) Onclick -  confirmAction()

function confirmAction() {

	var dialog = new GlideDialogWindow('show_resolution_code_notes');
	dialog.setTitle('Resolve');
	dialog.setPreference('sysid', g_form.getUniqueValue());
	dialog.render();
}

Output:

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

20 REPLIES 20

Ankur Bawiskar
Tera Patron
Tera Patron

@Steveanner 

OOB resolution code and notes become mandatory when you click Resolve button?

then why is this requirement?

So you want some kind of modal page to be opened and show those 2 fields.

So you would require UI page to be called from UI action and include the choice field to show the drop down and then one html input text field.

once user submits OK button those values would be updated

refer this example

https://community.servicenow.com/community?id=community_question&sys_id=6960d200db8edb404816f3231f96...

https://community.servicenow.com/community?id=community_question&sys_id=d0d0ad0ddb34b810414eeeb5ca96...

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

We are not sure which approach is good and it would be great help with the code for our requirement with best approach

Hi,

Why not use OOB approach only as that makes both the fields as mandatory when you click Resolve

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

We are planning to close this configuration looking for POP window it would be quick thing to us Resolve  the incident