Escalation Button on the Portal view - is this possible?

ToniOxley
Kilo Expert

Good Afternoon,

Please can someone advise? We would like to create a custom button on our portal view of the incident page for users (non licensed and licensed) to be able to press to escalate an incident in the queue. 

This is the page we would like the "Escalate" button to appear on (under the Actions section). We would like the escalation button to only be selectable if the incident is Active. 

find_real_file.png

Once the button has been pressed this should add a work note onto the incident at the back end to advise "this incident has been escalated by the caller" also to auto set the OOTB "escalation" field to "yes" (value : 1)

find_real_file.png

Can you please advise step by step how to achieve this.

Thank you very much, appreciate all help on this one.

7 REPLIES 7

Harsh Vardhan
Giga Patron

you have to use the condition in server side script of your button widget. and then use that variable in ng-if on html part. 

 

you can refer below blog which has mentioned an example. 

 

https://www.servicenowelite.com/blog/2017/5/12/service-portal-resolve-incident-button

ToniOxley
Kilo Expert

Good Morning, Thank you for this link... its really useful!

I have used the scripting as advised, can someone please help with how to incorporate into this new script creating a new escalate button (within the same widget)

On pressing the new escalate action button from the portal view, we need a box to appear to prompt the user to enter the reason for escalation, which needs to pull across into the work notes of the incident.

Also when the "Escalate Incident" action button is pressed we need our new "u_escalate" field on the back end incident form to become "true" - can you please advise where in the script i need to be looking for the new button and new actions if its selected? Thank you

Hi ToniOxley. Would be interested to understand how you have developed it and how this has landed. What are your lessons learnt and what would you do differently

ToniOxley
Kilo Expert

Server script:

(function() {

// Get table & sys_id
data.table = input.table || $sp.getParameter("table");
data.sys_id = input.sys_id || $sp.getParameter("sys_id");

// Valid GlideRecord
gr = new GlideRecord(data.table);
if (!gr.isValid())
return;

// Valid sys_id
if (!gr.get(data.sys_id))
return;

//Button Visibility
if (data.table == 'incident' && gr.active == true && gr.incident_state != 6 && gr.caller_id == gs.getUserID()) {
data.showWidget = true;
data.showResolve = true;
} else {
data.showWidget = false;
data.showResolve = false;
}

//input
if (input && input.action) {
var action = input.action;

//Incident table
if (data.table == 'incident') {
if (action == 'resolve' && input.resolveComments != '') {
gr.setValue('incident_state', 6);
gr.setValue('work_notes', "Closed by caller with comment: " + input.resolveComments);
gr.setValue('state', 6);
gr.setValue('resolved_by', gs.getUserID());
gr.setValue('close_notes', "Closed by caller with comment: " + input.resolveComments);
gr.update();
//data.response1 = gs.getMessage('Incident '+gr.number+' was resolved');
}
}
}
})();

 

Client Controller:

function($uibModal, $scope, spUtil) {
var c = this;

$scope.$on('record.updated', function(name, data) {
c.data.resolveComments = '';
spUtil.update($scope);
})

c.uiAction = function(action) {
c.data.action = action;
c.server.update().then(function() {
c.data.action = undefined;
})
c.modalInstance.close();
}
c.openModalResolve = function() {
c.modalInstance = $uibModal.open({
templateUrl: 'modalTemplateResolve',
scope: $scope
});
}

c.closeModal = function() {}


}