Creating an Emergency Change Request from an Incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2013 12:00 PM
We need to be able to create an Emergency Change Request from an Incident. The problem is that we have several mandatory fields on the Emergency Change Request that are not on the incident. When a user right clicks the banner and selects "Create Change", the change record is created before the user has a chance to enter the mandatory fields. To make matters worse, the user can navigate away from this new record and the mandatory fields are never filled out. We are trying to create a Quick form to value these fields before the Change Record gets created but it appears that these fields must be on the incident in order for them to be used to populate the Change Request. We are not anxious to add these Change Request fields to the incident. Is there a better way to make this work?
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2013 08:06 AM
If you make the "Create Change" UI action a client side action, you can have it open up a dialog window and require that the user fill in additional fields before submitting the new Emergency Change Request.
The dialog window is created by defining a UI page. Then you can render it from the client side UI action using GlideDialogWindow().
Then when the user submits the form, your script can create the new change request with data from the incident and data from the dialog window.
You should be able to find examples of GlideDialogWindow on the Wiki and Forum. But if you need more help with this, please let me know.
Meanwhile, here is an example of a form I use to update an issue request with additional information requested from the user:
The UI Action called "Open" asks the user for the issue owner and target release:
function iss_OpenIssue(){
var comment_block = g_form.getValue('u_comments');
var owner_ref = g_form.getReference('assigned_to');
var target_ref = g_form.getReference('u_targeted_release');
var owner_id = owner_ref.sys_id;
var target_id = target_ref.sys_id;
var owner_name = owner_ref.name || '';
var target_name = target_ref.u_name || '';
var gDialog = new GlideDialogWindow("Open Issue");
gDialog.setTitle('Open Issue');
gDialog.setPreference('table','Issue_Open');
gDialog.setPreference('owner_id',owner_id + '' || '');
gDialog.setPreference('owner_name',owner_name + '' || '');
gDialog.setPreference('comment_block',comment_block + '' || '');
gDialog.setPreference('target_id',target_id + '' || '');
gDialog.setPreference('target_name',target_name + '' || '');
gDialog.render();
}
The UI Page "Issue_Open" has the following html:
<g:ui_table>
<g:evaluate var="jvar_user_sysid" expression="RP.getWindowProperties().get('owner_id')" />
<g:evaluate var="jvar_user_name" expression="RP.getWindowProperties().get('owner_name')" />
<g:evaluate var="jvar_comment_text" expression="RP.getWindowProperties().get('comment_block')" />
<g:evaluate var="jvar_target_name" expression="RP.getWindowProperties().get('target_name')" />
<g:evaluate var="jvar_target_id" expression="RP.getWindowProperties().get('target_ip')" />
<!-- owner field -->
<tr class="header">
<td class="column_head">
<span class="slushselect">Owner</span>
</td>
</tr>
<tr>
<td>
<g2:ui_reference name="user" table="sys_user" value="${jvar_user_sysid}" displayvalue="${jvar_user_name}" />
</td>
</tr>
<!-- target release field -->
<tr class="header">
<td class="column_head">
<span class="slushselect">Targeted Release</span>
</td>
</tr>
<tr>
<td>
<g2:ui_reference name="QUERY:u_released=false" table="u_tools_releases" value="${jvar_target_id}" displayvalue="${jvar_target_name}" />
</td>
</tr>
<!-- comment field -->
<tr class="header">
<td class="column_head">
Comment:
</td>
</tr>
<tr>
<td>
<textarea id="issue_comments" rows="3" cols="65" wrap="soft">${jvar_comment_text}</textarea>
</td>
</tr>
<tr><td>
<!-- twin SELECTS -->
<div align="center">
<g:dialog_button onclick="return onSubmit();" name="ok_button" id="map_button">${gs.getMessage('OK')}</g:dialog_button>
<g:dialog_button onclick="cancel();" name="cancel_button" id="cancel_button">${gs.getMessage('Cancel')}</g:dialog_button>
</div>
</td></tr>
</g:ui_table>
<script>
var comment_contents = document.getElementById('issue_comments');
if (comment_contents.innerHTML == ' ') {
comment_contents.innerHTML = '';
}
</script>
And here is the client script for the UI page:
function onSubmit() {
var ic = document.getElementById('issue_comments');
var iu = document.getElementById('user');
var tr = document.getElementById('QUERY:u_released=false');
if((iu.value == '') || (iu.value == 'undefined')) {
alert("Please select a user.");
return false;
}
else {
g_form.setValue('assigned_to',iu.value);
g_form.setValue('u_targeted_release',tr.value);
if (ic.value.length > 1) {
g_form.setValue('u_comments',ic.value+'');
}
g_form.setValue('u_status','Open');
var rightnow = AJAXEvaluateSynchronously("gs.nowDateTime()");
gsftSubmit(gel('sysverb_update_and_stay'));
GlideDialogWindow.get().destroy();
return true;
}
}
function cancel() {
GlideDialogWindow.get().destroy();
}
Cheers,
Geoff.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2013 05:32 AM
Thank you Geoff. We also had to set up a Force Save Client Script and add save() to the bottom of the UI Action to get this to save the change request number on the original incident. I appreciate your help.