Users should not be able to close tickets from employee center

Edward Rosario
Mega Sage
Mega Sage

From my Tickets a user can Resolve an incident (this is OK),  but once resolved they can then Close a resolved incident. 

This should not be allowed, closing should only be done by admins or the system.  Where can I edit this to meet the above criteria?

1 ACCEPTED SOLUTION

Clara Lemos
Mega Sage

Hi @Edward Rosario ,

 

You can navigate to the Script Includes table and open this one: 'IncidentUtils'

If you verify the code in there you can add below the comment : /***************Custom changes****************/

The function canCloseIncident, in this function you should add the condition to show the "close" option. 

You probably are looking for something like below 🙂 

 

var IncidentUtils = Class.create();
IncidentUtils.prototype = Object.extendsObject(IncidentUtilsSNC, {
    initialize: function() {
        IncidentUtilsSNC.prototype.initialize.call(this);
    },

    /***************Custom changes****************/
    canCloseIncident: function(current) {
        if (current.incident_state != IncidentState.RESOLVED)
            return false;
        if (gs.hasRole("admin"))
            return true;
        return false;
    },

    type: 'IncidentUtils'
});

 

 

 

 

If that helps please mark my answer as correct / helpful!
And if further help is needed please let me know

Cheers

 

View solution in original post

5 REPLIES 5

Clara Lemos
Mega Sage

Hi @Edward Rosario ,

 

You can navigate to the Script Includes table and open this one: 'IncidentUtils'

If you verify the code in there you can add below the comment : /***************Custom changes****************/

The function canCloseIncident, in this function you should add the condition to show the "close" option. 

You probably are looking for something like below 🙂 

 

var IncidentUtils = Class.create();
IncidentUtils.prototype = Object.extendsObject(IncidentUtilsSNC, {
    initialize: function() {
        IncidentUtilsSNC.prototype.initialize.call(this);
    },

    /***************Custom changes****************/
    canCloseIncident: function(current) {
        if (current.incident_state != IncidentState.RESOLVED)
            return false;
        if (gs.hasRole("admin"))
            return true;
        return false;
    },

    type: 'IncidentUtils'
});

 

 

 

 

If that helps please mark my answer as correct / helpful!
And if further help is needed please let me know

Cheers

 

Hi Clara, 
Thank you so much.  Quick question, Can I edit the "if" statement to hide the close button.  for example, once the non-admin user resolves their ticket the "close" button never shows up.  it only shows up for an admin

 

Thanks Clara, the code worked great.

Clara Lemos
Mega Sage

Hi @Edward Rosario ,

 

The code above will only return true if it is resolved and the user is an admin.

Let me know what is not working for you 🙂