Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Unable to see Reopen button in EC portal

vidhya_mouli
Tera Sage

 

I am unable to see reopen button in the EC portal.

 

My-Request-INC0010959-Onitio-Helpdesk.png

 

I read this one of the blogs:

In order to make the Reopen action visible according to your needs, you can choose to override this method in 

IncidentUtils.
 
  canReopenIncident: function(current) {
        return current.incident_state == IncidentState.RESOLVED && !gs.getUser().hasRoles() && !this._isMajorIncident(current);
    }

 

But still unable to resolve it. I want anyone with an itil role or snc_internal role to be able to reopen the incident. How do I do this?

1 ACCEPTED SOLUTION

Clara Lemos
Mega Sage

Hi @vidhya_mouli ,

 

Go to the 'IncidentUtils' script include and add the canReopenIncident function with you requirements in line 6 of the script, it will be something like this : 

Screenshot 2023-11-02 at 11.25.39.png

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

4 REPLIES 4

Clara Lemos
Mega Sage

Hi @vidhya_mouli ,

 

Go to the 'IncidentUtils' script include and add the canReopenIncident function with you requirements in line 6 of the script, it will be something like this : 

Screenshot 2023-11-02 at 11.25.39.png

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

Cheers

Thank you for your input. However, when I add this code to IncidenUtils, it completely removes the Action button. Not sure why?

Hi @vidhya_mouli ,

 

If you send a screenshot, I can take a look. My guess would be to check if you have misspelled something. For example, if you are checking if the user has a role, like I did on mine, be careful not to use 'gs.getUser().hasRoles()' instead of 'gs.getUser().hasRole()'.

I used this code:

var IncidentUtils = Class.create();
IncidentUtils.prototype = Object.extendsObject(IncidentUtilsSNC, {
    initialize: function() {
    IncidentUtilsSNC.prototype.initialize.call(this);
    },
 
    /***************Custom changes****************/
        canReopenIncident: function(current) {
        return current.incident_state == IncidentState.RESOLVED && gs.getUser().getRoles().length > 0 && !this._isMajorIncident(current);
    },
    
    type: 'IncidentUtils'   
});