- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2018 03:01 PM
Hi all,
I'm looking to do something very much like the "reopen incident button" widget described here (which works perfectly, BTW, thank you), but what I need is to have a button that will allow our users to request escalation of their issue. We are not using SLA/Workflow to automatically escalate incidents (yet) and we are not quite ready to.
https://community.servicenow.com/community?id=community_article&sys_id=db298e11db97d380fece0b55ca96195f
I would imagine the solution in the linked article can be modified to do what we need it to, I'm just not sure where to start. The desired outcome would be: User clicks a "Request Escalation" button in the service portal, types their reason, and clicks SUBMIT. The Submit button (ideally) would do 2 things: Add the escalation request reason to the incident comments, and send the incident info and escalation request notification to a designated group of people.
I am not a coder/scripter but I can follow directions easily, as long as they are clear 🙂
Thoughts? Thank you!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 10:36 AM
Thank you very much Pradeep, I was able to implement this with minor changes very easily. All I changed was the button visibility - from "only show if state is resolved" to "only show if state is new/in progress/on hold".
Also added a new state "Escalated", which as suggested is triggering the email notification.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2018 02:30 AM
Morning Pradeep
I have come across your script which works perfectly for Incidents, but we need to be able to give our users the ability to escalate Requests to.
Can you please give me some assistance with amending the Server Script to also include the sc_request table on the same widget, as I am getting an error on the code
Just for your awareness I have a checkbox on the incident (u_escalate_this_incident) and request (u_escalate_this_service_request) forms which is ticketed if the ticket is escalated
This is what I have done:-
(function() {
// Get table & sys_id
data.table = input.table || $sp.getParameter("table");
data.sys_id = input.sys_id || $sp.getParameter("sys_id");
// Valid GlideRecord
var 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 == 2 || gr.incident_state == 3) && gr.u_escalate_this_incident == false && (gr.caller_id == gs.getUserID() || gr.opened_by == gs.getUserID())){
if(data.table == 'sc-request' && gr.active == true && gr.u_escalate_this_service_request == false && (gr.caller_id == gs.getUserID() || gr.opened_by == gs.getUserID())){
data.showWidget = true;
data.showReopen = true;
} else {
data.showWidget = false;
data.showReopen = false;
}
//input
if (input && input.action === 'reopen') {
// If Incident table
if (data.table == 'incident') {
gr.setValue('u_escalate_this_incident', 'true');
gr.comments = "Ticket Escalate. \nEscalated with comments: "+ input.reopenComments;
gr.update();
if (data.table == 'sc_request'){
gr.setValue('u_escalate_this_service_request',true)
gr.comments = "Ticket Escalate. \nEscalated with comments: "+ input.reopenComments;
gr.update();
}
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2018 12:15 PM
Hi Jonathan,
Try this, it worked for me:
Instead of:
//Button Visibility
if(data.table == 'incident' && gr.active == true && (gr.incident_state == 2 || gr.incident_state == 3) && gr.u_escalate_this_incident == false && (gr.caller_id == gs.getUserID() || gr.opened_by == gs.getUserID())){
if(data.table == 'sc-request' && gr.active == true && gr.u_escalate_this_service_request == false && (gr.caller_id == gs.getUserID() || gr.opened_by == gs.getUserID())){
data.showWidget = true;
data.showReopen = true;
} else {
data.showWidget = false;
data.showReopen = false;
}
Try:
//Button Visibility
if(data.table == 'incident' || 'sc_request' && gr.active == true && (gr.incident_state == 2 || gr.incident_state == 3) && gr.u_escalate_this_incident == false && (gr.caller_id == gs.getUserID() || gr.opened_by == gs.getUserID()))
{
data.showWidget = true;
data.showReopen = true;
}
else {
data.showWidget = false;
data.showReopen = false;
}
And change:
// If Incident table
if (data.table == 'incident') {
gr.setValue('u_escalate_this_incident', 'true');
gr.comments = "Ticket Escalate. \nEscalated with comments: "+ input.reopenComments;
gr.update();
if (data.table == 'sc_request'){
gr.setValue('u_escalate_this_service_request',true)
gr.comments = "Ticket Escalate. \nEscalated with comments: "+ input.reopenComments;
gr.update();
}
}
})();
To:
// If Incident table
if (data.table == 'incident' || 'sc_request') {
gr.setValue('u_escalate_this_incident', 'true');
gr.comments = "Ticket Escalate. \nEscalated with comments: "+ input.reopenComments;
gr.update();
Also, make sure you have as "sc_request" not "sc-request" (you have the latter in your snippet).
I hope this helps.
And much thanks to Pradeep and @robinsamberg for providing the code to begin with.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-20-2020 11:55 PM
Hi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2018 06:43 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2018 10:39 AM
Thanks so much for your suggestion and XML file! I did try to implement this, but until I have time to figure out everything I need to have in place - I had to go with Pradeep's solution for now. I appreciate your reply!
Robin