Resolve Incident Button Issue

Cupcake
Mega Guru

I have found an issue with displaying the Resolve Incident button (UI Action) on some incidents and not others both having the same state and I don't understand what the difference is.

So I have 

a) ACLs in place that state that the State and other fields of an incident cannot be changed if that incident is assigned to specific assignment groups are if you are NOT a member of that group.

b) I also have conditions in the UI Action as follows:

((current.incident_state != 7 && current.incident_state != 6) || (current.state != 7 && current.state != 6))&& (gs.hasRole("itil") || gs.hasRole("itil_admin") || current.caller_id == gs.getUserID()) && new ResButton().checkIncTask()

But I don't understand why the Resolve Incident button is some incidents and not others. See screenshots below. I am going to keep looking to see if I can figure this out.

Any assistance would be much appreciated.

 

1 ACCEPTED SOLUTION

You are very welcome. Here is the updated code.

var ResButton = Class.create();
ResButton.prototype = Object.extendsObject(AbstractAjaxProcessor, {
checkIncTask: function(){
var incTask = new GlideRecord("u_inc_task");
incTask.addQuery("u_inc", current.sys_id);
incTask.addQuery("active", true);
incTask.query();
if(incTask.next()){
return false;
}
else if(current.assignment_group.getDisplayValue() == 'PASS ASSIGNMENT GROUP NAME HERE')
{
return false;
}
else{
return true;
}
},


type: 'ResButton'
})

 

-Pradeep Sharma

View solution in original post

14 REPLIES 14

Thanks for the update. Could you please check if there are any Active Incident Tasks for Incident INC0421689? If Yes, then as per the script the "Resolve" UI Action button will be hidden.

 

-Pradeep Sharma

Yes there is one open Incident task.

 

find_real_file.png

This is working as expected i.e Resolved button will be hidden if there are active incident Tasks. I think for other Incident the button is visible because there are no active Incident Tasks. Could you please confirm?

 

-Pradeep Sharma

That is correct there are no Active Incident tasks. So now I need to solve for 

If there are no active incident tasks and the incident is assigned to a specific assignment group then I also do not want the Resolve Incident button to show.

 

And I would like to humbly thank for teaching me why it was acting that way.

Karen

You are very welcome. Here is the updated code.

var ResButton = Class.create();
ResButton.prototype = Object.extendsObject(AbstractAjaxProcessor, {
checkIncTask: function(){
var incTask = new GlideRecord("u_inc_task");
incTask.addQuery("u_inc", current.sys_id);
incTask.addQuery("active", true);
incTask.query();
if(incTask.next()){
return false;
}
else if(current.assignment_group.getDisplayValue() == 'PASS ASSIGNMENT GROUP NAME HERE')
{
return false;
}
else{
return true;
}
},


type: 'ResButton'
})

 

-Pradeep Sharma