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

Hi,

sorry I didn't get your question

Regards
Ankur

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

We are planning to shutoff the OOB approach or we introduce the popup window approach also the users to experience for quick resolve

 

It would be great help if you share code based on our requirement

 

Thanks,

Steve An

@Steveanner 

the above links should help you

they show how you can update the record using UI page

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

Hello, We are not much familiar with the ui pages and if any one provide pice of code to achieve this it would be great help Thanks, Steve an

@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