- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 01:08 AM - edited 11-03-2023 01:10 AM
I am overriding canReopen() function on IncidentUtils.
When I write the following code, UI Action button is visible in the Employee portal.
canReopenIncident: function(current) {
return current.incident_state == IncidentState.RESOLVED && gs.getUser().hasRoles() && !this._isMajorIncident(current);
},
Whereas, when I write the following code, UI action button disappears in the Employee center.
canReopenIncident: function(current) {
return current.incident_state == IncidentState.RESOLVED && gs.getUser().hasRoles("snc_internal,itil") && !this._isMajorIncident(current);
},
The user does have itil role. Also, if canReopen() return false value, it should only remove the reopen button and not the entire action button.
What is the problem here?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 04:29 AM
Hi @vidhya_mouli ,
Use gs.hasRole('itil') instead gs.getUser().hasRoles()
FYI --gs.getUser().hasRoles() -Returns true if the user has any roles at all, false if the user has no role.
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 04:29 AM
Hi @vidhya_mouli ,
Use gs.hasRole('itil') instead gs.getUser().hasRoles()
FYI --gs.getUser().hasRoles() -Returns true if the user has any roles at all, false if the user has no role.
Thank you,
Hemanth
Certified Technical Architect (CTA), ServiceNow MVP 2024, 2025