Incident design

Overview

After much discussion it was decided that certain requests, which we're calling 'generic requests' would live in the incident module.  The goal is to avoid the overhead of full requests for simple, one and done tasks such as questions.  The service offering and category selection determines if an incident, generic request, or full structured(catalog) request will be created.

Technical Design

Each service offering has its own set of categories.  On each category there is a support group and an escalation group.  There is also a flag called 'Generic Request' which denotes if this will make the incident a generic request or not.

Category

Generic requests do not have SLAs.  This is done by filtering based on the generic request flag.

SLA example


Categories can have catalog items attached, which means that if a service offering and a category have a catalog item attached, the incident will automatically be converted to a full blown request.  Any information that may have been entered on the incident form will be copied over to the request.  The incident will then be closed as invalid.

When the category changes to one that meets the criteria for a structured request, the user is presented with a dialog.

Client Script

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (isLoading || newValue == '') {
		return;
	}
	
	//Prompt to create a catalog item if one exists for the selected offering and category
	if (g_form.getReference('u_category').u_catalog_item){
		conversionDialog();
	}
	
	function conversionDialog() {
		//Get the values to pass into the dialog
		
		var gr = new GlideRecord('sc_cat_item');
		if (gr.get(g_form.getReference('u_category').u_catalog_item)) {
			var item = gr.name;
		}
		
		//Initialize and open the dialog
		var dialog = new GlideDialogWindow("conversion_dialog"); //Instantiate the dialog containing the UI Page 'conversion_dialog'
		dialog.setTitle("Ticket Conversion"); //Set the dialog title
		
		dialog.setPreference("catalog_item", item); //Pass the comments into the dialog
		dialog.render(); //Open the dialog
	}
}

UI Page

The user must select either 'Yes' or 'No.'  If they select 'No' the category will be cleared out and the user must select another one.  If they click 'Yes' the UI Action code fires.

<g:ui_form>
  <!-- Get the values from dialog preferences -->
<g:evaluate var="jvar_catalog_item"
    expression="RP.getWindowProperties().get('catalog_item')" />
   <!-- Set up form fields and labels -->
<style>
#popup_close_image
{
display:none;
}
</style>   
<table width="100%">
     <tr id="description_row" valign="top">
        <td colspan="2">
           <!-- Short description value used as a label -->
           A catalog item is available for this service offering and category combination.  This ticket will be converted to the available catalog item '${jvar_catalog_item}'.
        </td>
     </tr>
     <tr id="dialog_buttons">
        <td colspan="2" align="right">
           <!-- Add OK/Cancel buttons. Clicking OK calls the validateComments script -->
           <g:dialog_buttons_ok_cancel ok="g_form.checkMandatory = false;gsftSubmit(null, g_form.getFormElement(), 'convert_incident');" ok_type="button" cancel_type="button" cancel="g_form.setValue('u_category',false);GlideDialogWindow.get().destroy();" />
        </td>
     </tr>
  </table>
</g:ui_form>


UI Action

If this isn't a new record, we need to close the incident that was created.  We redirect the user to the appropriate catalog item for the category selected, and pass the current values of the ticket as parameters.  A client script on each item parses the parameters and fills in the default values.

if(! current.isNewRecord()){
	current.state = 14;
	current.comments = "Incident closed to open catalog item : '" + current.u_category.u_catalog_item.name + "'";
	
	current.update();
}
var url = "com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=" + current.u_category.u_catalog_item + "&sysparm_description=" + current.description + "&sysparm_short_description=" + current.short_description + "&sysparm_client=" + current.u_client + "&sysparm_contact=" + current.caller_id + "&sysparm_category=" + current.u_category +  "&sysparm_business_service=" + current.u_business_service + "&sysparm_affiliation=" + current.u_client.u_primary_affiliation;
action.setRedirectURL(url);

If the category is determined to be a generic request the generic request flag is set.

Business Rule

if(current.u_category.u_generic_request == true){
	current.u_generic_request = true;
}else{
	current.u_generic_request = false;
}