- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2020 10:43 PM
Hi Team,
We are implementing Major Incident Workbench functionality. Now the challenge is when the Incident Manager promoting the proposed incident then the incident should be automatically moved either P1 / P2 respectively.
Or while prompting the incident to major incident, we can have a drop down asking incident manager whether the incident can be P1/ P2.
Please help me, how we can proceed. Thanks in advance.
Regards,
Rups
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2020 01:42 PM
This was achieved via modifying the UI Page "mim_workbench_promote" with the following:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<!-- To use <g:ui_reference/> in this UI page, below are the required JS.
<g:requires name="scripts/functions.js" includes="true" />
<g:requires name="scripts/functions_reference.js" includes="true" />
<g:requires name="scripts/utils.js" includes="true" />
<g:requires name="scripts/accessibility_tabindex.js" includes="true" />
<g:requires name="scripts/slushbucket.js" includes="true" />
<g:requires name="scripts/ac.js" includes="true" />
<g:requires name="scripts/ac_derived_field_support.js" includes="true" />
<g:requires name="scripts/popups.js" includes="true" />
<g:requires name="scripts/classes/AutoComplete.js" includes="true" />
<g:requires name="scripts/classes/SlushBucket.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXCompleter.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXReferenceControls.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXOtherCompleter.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXReferenceCompleter.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXReferenceCompleterMulti.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXTableCompleter.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXEmailClientCompleter.js" includes="true" />
<j2:set var="jvar_theme" value="$[gs.getProperty('glide.css.theme.ui16')]"/>
<g2:requires name="styles/css_includes_doctype.css" includes="true" params="c=$[gs.getCssCacheVersionString()]$[jvar_theme]" />
-->
<style>
.form-horizontal {
margin-top: 5px;
margin-bottom: 20px;
}
.promote-modal-textarea {
resize: vertical;
min-height: 120px
}
#dialog_buttons .btn{
margin-left: 10px;
padding-left: 15px;
padding-right: 15px;
}
#work-notes-wrapper .required-marker {
display: inline-block;
}
</style>
<div class="form-horizontal">
<div class="form-group" id="work-notes-wrapper">
<label class="col-sm-2 control-label" for="mim-promote-work-notes">
<span mandatory="true" class="required-marker label_description"></span>
${gs.getMessage('Work notes')}
</label>
<div class="col-sm-10">
<textarea required="true" class="form-control promote-modal-textarea" id="mim-promote-work-notes" type="text" oninput="promoteModal.workNotesOnChange()" onchange="promoteModal.workNotesOnChange()"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="mim-promote-business-impact">${gs.getMessage('Business Impact')}</label>
<div class="col-sm-10">
<textarea class="form-control promote-modal-textarea" name="mim-promote-business-impact" id="mim-promote-business-impact"></textarea>
</div>
</div>
<!--Below Added to allow priority selection -->
<div class="form-group">
<label class="col-sm-2 control-label" for="incident-priority">${gs.getMessage('Incident Priority')}</label>
<div class="col-sm-10">
<select required="true" id="incident-priority" class="form-control" name="incident-priority">
<option value="1">${gs.getMessage("P1 - Very High")}</option>
<option value="2">${gs.getMessage("P2 - High")}</option>
</select>
</div>
</div>
</div>
<div id="dialog_buttons" class="clearfix pull-right">
<button type="button" class="btn btn-default" onclick="promoteModal.close()" title="${gs.getMessage('Close the dialog')}">${gs.getMessage('Cancel')}</button>
<button type="button" class="btn btn-primary disabled" aria-disabled="true" id="mim-promote-button" title="${gs.getMessage('Promote to Major Incident')}" onclick="promoteModal.promote()">${gs.getMessage('Promote')}</button>
</div>
</j:jelly>
(function(global) {
var workNotes = $("mim-promote-work-notes");
var businessImpact = $("mim-promote-business-impact");
var workNotesWrapper = $('work-notes-wrapper');
var promoteBtn = $('mim-promote-button');
var priority = $('incident-priority');
workNotes.focus();
if(priority.value == 1){
var impact = 1;
} else {
var impact = 2;
}
var dialog = GlideModal.prototype.get("sn_major_inc_mgmt_mim_workbench_promote");
var currentWorkNotes = dialog.getPreference('WORK_NOTES');
if(currentWorkNotes) {
workNotes.value = currentWorkNotes;
workNotesOnChange();
}
var currentBusinessImpact = dialog.getPreference('BUSINESS_IMPACT');
if(currentBusinessImpact)
businessImpact.value = currentBusinessImpact;
function _debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this,
args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
}
function workNotesOnChange() {
if (!workNotes.value.trim()) {
workNotesWrapper.removeClassName('is-filled');
promoteBtn.addClassName('disabled');
promoteBtn.writeAttribute('aria-disabled', true);
} else {
workNotesWrapper.addClassName('is-filled');
promoteBtn.removeClassName('disabled');
promoteBtn.writeAttribute('aria-disabled', false);
}
}
function _promoteRestCall(record) {
var dfd = $j.Deferred();
var api = '/api/sn_major_inc_mgmt/mim/actions/' + window.NOW.MAJOR_INCIDENT_WORKBENCH.sys_id;
var data = {
action: 'PROMOTE',
record: record
};
$j.ajax({
type: 'POST',
url: api,
data: JSON.stringify(data),
success: function(data) {
dfd.resolve(data);
},
error: function() {
dfd.reject();
},
contentType: "application/json",
dataType: 'json'
});
return dfd.promise();
}
function promote() {
getMessage("Promoted to a major incident", function(msg) {
var updateWorkNotes = msg + "\n" + workNotes.value.trim();
if (!promoteBtn.hasClassName('disabled')) {
if (window.NOW.MAJOR_INCIDENT_WORKBENCH) {
var record = {};
record.work_notes = updateWorkNotes;
record.business_impact = businessImpact.value;
record.impact = impact;
record.urgency = "2";
_promoteRestCall(record).then(function() {
dialog.setPreference('reload', true);
close();
});
} else {
//When UI Page is rendered from Form UI Action
g_form.getControl('work_notes').value = updateWorkNotes;
g_form.setValue('business_impact', businessImpact.value);
g_form.setValue('impact',impact);
g_form.setValue('urgency',"1");
GlideModal.prototype.get('sn_major_inc_mgmt_mim_workbench_promote').destroy();
gsftSubmit(null, g_form.getFormElement(), 'sysverb_mim_accept');
}
}
});
}
function close() {
dialog.destroy();
}
global.promoteModal = {
promote: promote,
close: close,
workNotesOnChange: _debounce(workNotesOnChange, 200) // Only execute when left idle for 200 ms
};
})(window);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2020 01:42 PM
This was achieved via modifying the UI Page "mim_workbench_promote" with the following:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<!-- To use <g:ui_reference/> in this UI page, below are the required JS.
<g:requires name="scripts/functions.js" includes="true" />
<g:requires name="scripts/functions_reference.js" includes="true" />
<g:requires name="scripts/utils.js" includes="true" />
<g:requires name="scripts/accessibility_tabindex.js" includes="true" />
<g:requires name="scripts/slushbucket.js" includes="true" />
<g:requires name="scripts/ac.js" includes="true" />
<g:requires name="scripts/ac_derived_field_support.js" includes="true" />
<g:requires name="scripts/popups.js" includes="true" />
<g:requires name="scripts/classes/AutoComplete.js" includes="true" />
<g:requires name="scripts/classes/SlushBucket.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXCompleter.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXReferenceControls.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXOtherCompleter.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXReferenceCompleter.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXReferenceCompleterMulti.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXTableCompleter.js" includes="true" />
<g:requires name="scripts/classes/ajax/AJAXEmailClientCompleter.js" includes="true" />
<j2:set var="jvar_theme" value="$[gs.getProperty('glide.css.theme.ui16')]"/>
<g2:requires name="styles/css_includes_doctype.css" includes="true" params="c=$[gs.getCssCacheVersionString()]$[jvar_theme]" />
-->
<style>
.form-horizontal {
margin-top: 5px;
margin-bottom: 20px;
}
.promote-modal-textarea {
resize: vertical;
min-height: 120px
}
#dialog_buttons .btn{
margin-left: 10px;
padding-left: 15px;
padding-right: 15px;
}
#work-notes-wrapper .required-marker {
display: inline-block;
}
</style>
<div class="form-horizontal">
<div class="form-group" id="work-notes-wrapper">
<label class="col-sm-2 control-label" for="mim-promote-work-notes">
<span mandatory="true" class="required-marker label_description"></span>
${gs.getMessage('Work notes')}
</label>
<div class="col-sm-10">
<textarea required="true" class="form-control promote-modal-textarea" id="mim-promote-work-notes" type="text" oninput="promoteModal.workNotesOnChange()" onchange="promoteModal.workNotesOnChange()"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label" for="mim-promote-business-impact">${gs.getMessage('Business Impact')}</label>
<div class="col-sm-10">
<textarea class="form-control promote-modal-textarea" name="mim-promote-business-impact" id="mim-promote-business-impact"></textarea>
</div>
</div>
<!--Below Added to allow priority selection -->
<div class="form-group">
<label class="col-sm-2 control-label" for="incident-priority">${gs.getMessage('Incident Priority')}</label>
<div class="col-sm-10">
<select required="true" id="incident-priority" class="form-control" name="incident-priority">
<option value="1">${gs.getMessage("P1 - Very High")}</option>
<option value="2">${gs.getMessage("P2 - High")}</option>
</select>
</div>
</div>
</div>
<div id="dialog_buttons" class="clearfix pull-right">
<button type="button" class="btn btn-default" onclick="promoteModal.close()" title="${gs.getMessage('Close the dialog')}">${gs.getMessage('Cancel')}</button>
<button type="button" class="btn btn-primary disabled" aria-disabled="true" id="mim-promote-button" title="${gs.getMessage('Promote to Major Incident')}" onclick="promoteModal.promote()">${gs.getMessage('Promote')}</button>
</div>
</j:jelly>
(function(global) {
var workNotes = $("mim-promote-work-notes");
var businessImpact = $("mim-promote-business-impact");
var workNotesWrapper = $('work-notes-wrapper');
var promoteBtn = $('mim-promote-button');
var priority = $('incident-priority');
workNotes.focus();
if(priority.value == 1){
var impact = 1;
} else {
var impact = 2;
}
var dialog = GlideModal.prototype.get("sn_major_inc_mgmt_mim_workbench_promote");
var currentWorkNotes = dialog.getPreference('WORK_NOTES');
if(currentWorkNotes) {
workNotes.value = currentWorkNotes;
workNotesOnChange();
}
var currentBusinessImpact = dialog.getPreference('BUSINESS_IMPACT');
if(currentBusinessImpact)
businessImpact.value = currentBusinessImpact;
function _debounce(func, wait, immediate) {
var timeout;
return function() {
var context = this,
args = arguments;
var later = function() {
timeout = null;
if (!immediate) func.apply(context, args);
};
var callNow = immediate && !timeout;
clearTimeout(timeout);
timeout = setTimeout(later, wait);
if (callNow) func.apply(context, args);
};
}
function workNotesOnChange() {
if (!workNotes.value.trim()) {
workNotesWrapper.removeClassName('is-filled');
promoteBtn.addClassName('disabled');
promoteBtn.writeAttribute('aria-disabled', true);
} else {
workNotesWrapper.addClassName('is-filled');
promoteBtn.removeClassName('disabled');
promoteBtn.writeAttribute('aria-disabled', false);
}
}
function _promoteRestCall(record) {
var dfd = $j.Deferred();
var api = '/api/sn_major_inc_mgmt/mim/actions/' + window.NOW.MAJOR_INCIDENT_WORKBENCH.sys_id;
var data = {
action: 'PROMOTE',
record: record
};
$j.ajax({
type: 'POST',
url: api,
data: JSON.stringify(data),
success: function(data) {
dfd.resolve(data);
},
error: function() {
dfd.reject();
},
contentType: "application/json",
dataType: 'json'
});
return dfd.promise();
}
function promote() {
getMessage("Promoted to a major incident", function(msg) {
var updateWorkNotes = msg + "\n" + workNotes.value.trim();
if (!promoteBtn.hasClassName('disabled')) {
if (window.NOW.MAJOR_INCIDENT_WORKBENCH) {
var record = {};
record.work_notes = updateWorkNotes;
record.business_impact = businessImpact.value;
record.impact = impact;
record.urgency = "2";
_promoteRestCall(record).then(function() {
dialog.setPreference('reload', true);
close();
});
} else {
//When UI Page is rendered from Form UI Action
g_form.getControl('work_notes').value = updateWorkNotes;
g_form.setValue('business_impact', businessImpact.value);
g_form.setValue('impact',impact);
g_form.setValue('urgency',"1");
GlideModal.prototype.get('sn_major_inc_mgmt_mim_workbench_promote').destroy();
gsftSubmit(null, g_form.getFormElement(), 'sysverb_mim_accept');
}
}
});
}
function close() {
dialog.destroy();
}
global.promoteModal = {
promote: promote,
close: close,
workNotesOnChange: _debounce(workNotesOnChange, 200) // Only execute when left idle for 200 ms
};
})(window);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2020 07:00 PM
Hi Kieran,
Appreciate for all the work you put in and thank you so much.
Rather modifying the UI page, are we good to have trigger rules where the incident auto propose to Major Incident. Please advise.
We tried to create trigger rules with eg : Priority = P1/P2; then incident should be proposed to Major Incident, but unable to achieve it. do we require to script anywhere to achieve.
Thanks in advance.
Regards,
Rups
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-18-2022 09:54 AM
Hi Kieran,
This is helpful - i tried doing it and it seems to be working in native UI but not in Workspace - any thoughts?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2020 11:31 AM
Hi Kieran,
How you make this an auto-update, instead of giving the option to selection? Lets say, anytime someone "Promote Major Incident" it comes as a P2.
Also, is it possible to make a field on the incident form mandatory when "Promote Major Incident"? For example, I am struggling making a field (u_region) mandatory before submitting the MI. Or "Promote Major Incident" is dependent on the field being filled.
Thank you for your help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2020 11:39 AM
As this is a separate question , please raise a new question 10+ Tips for writing a quality community question