- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2021 02:00 AM
Hello Community Folks,
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
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2021 08:51 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2021 02:46 AM
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
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2021 02:51 AM
We are not sure which approach is good and it would be great help with the code for our requirement with best approach
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2021 03:10 AM
Hi,
Why not use OOB approach only as that makes both the fields as mandatory when you click Resolve
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2021 03:15 AM
We are planning to close this configuration looking for POP window it would be quick thing to us Resolve the incident