
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-28-2018 08:26 AM
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.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-28-2018 10:49 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-28-2018 08:34 AM
Hi,
Can you please share the script of the function ResButton()
-Pradeep Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-28-2018 08:48 AM
Hi Pradeep,
function resolveIncident(){
//Set the 'Incident state' and 'State' values to 'Resolved', and display mandatory fields
g_form.setValue('incident_state', 6);
g_form.setValue('state', 6);
//commented out below IF condition only because the mandatory fields should be taken care by the UI policy.
/*if (g_form.getValue('comments') == '') {
//Remove any existing field message, set comments mandatory, and show a new field message
try {g_form.hideFieldMsg('comments');} catch(e) {}
g_form.setMandatory('comments', true);
g_form.showFieldMsg('comments','Comments are required when resolving an Incident','error');
return false; //Abort submission
}*/
//Call the UI Action and skip the 'onclick' function
gsftSubmit(null, g_form.getFormElement(), 'resolve_incident'); //MUST call the 'Action name' set in this UI Action
}
//Code that runs without 'onclick'
//Ensure call to server-side function with no browser errors
if (typeof window == 'undefined')
serverResolve();
function serverResolve(){
current.incident_state = 6;
current.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-28-2018 08:51 AM
Hi Kbrownibx,
I was referring to the Script Include call from UI action condition i.e new ResButton().checkIncTask(). Could you please share the script of ResButton function call
-Pradeep Sharma

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā09-28-2018 08:57 AM
Sorry about that. My copy and paste must have the last thing that I copied.
Here you are:
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{
return true;
}
},
type: 'ResButton'
});