
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2019 01:27 AM
Dear Community,
I was wondering if someone could help with the following…
We need to hide the ‘Close Incident’ button (affect all users) when the ticket is in a ‘State’ of Resolved. It currently serves no purpose at present, and that confuses some people. incident.[incident]
I’m a novice, so any instructions or advice would need to be perfectly clear. Baby steps would be nice. 🙂
Your help will be much appreciated.
Kind regards,
Pierre
Solved! Go to Solution.
- Labels:
-
Request Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2019 09:41 PM
You will have to put that in the condition as well.
(current.incident_state != '1' && current.incident_state != '7' && current.incident_state != '6') && (gs.hasRole("itil") || gs.hasRole("itil_admin") || current.caller_id == gs.getUserID() || gs.hasRole("admin"))
Hope you got the resolution with my help.
Can you mark correct answer to close this thread?
Regards,
Omkar Mone

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2019 04:40 AM
What if I wanted to hide it from admins as well?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2019 09:41 PM
You will have to put that in the condition as well.
(current.incident_state != '1' && current.incident_state != '7' && current.incident_state != '6') && (gs.hasRole("itil") || gs.hasRole("itil_admin") || current.caller_id == gs.getUserID() || gs.hasRole("admin"))
Hope you got the resolution with my help.
Can you mark correct answer to close this thread?
Regards,
Omkar Mone

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2019 02:42 AM
Hi Omkar,
The Condition field has a limit in how many characters supported. If I want to add this as a function in the script, what would it look like.
My Condition is too long because of the amount of roles.
(current.incident_state != '1' && current.incident_state != '7' && current.incident_state != '6') && (gs.hasRole("itil") || gs.hasRole("itil_admin") || gs.hasRole("admin") || gs.hasRole("assessment_admin") || gs.hasRole("certification") || gs.hasRole("cmdb_query_builder") || gs.hasRole("dependency_views") || gs.hasRole("sn_bm_client.benchmark_data_viewer") || gs.hasRole("template_editor") || gs.hasRole("view_changer")current.caller_id == gs.getUserID())
The current Script/functions are:
What would the condition look like in the below script please.
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);
g_form.setValue('resolved_by', g_user.userID);
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 = IncidentState.RESOLVED;
current.state = IncidentState.RESOLVED;
current.update();
current.resolved_by = gs.getUserID();
}
Kind regards,
Pierre

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2019 01:48 AM
You just need to add condition in UI Action 'Close Incident'.
current.state != '6' //6 is the value of resolve state
Regards,
Sanket

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2019 04:36 AM
I have a meeting at 12:40 (6 mins) so will be unavailable to reply or check anything for at least an hour.
Thanks everyone, hopefully I won't need the rope!