Hide 'Resolve' button and 'Resolved' state when there are an active Incident Tasks

Basim Zaidi
Mega Expert

Hi community,

Any help would be appreciated here!

I require to hide the 'Resolve' button and 'Resolved' state of an Incident if there are active Incident Tasks associated to a parent Incident record (if the logged on user is not admin).  I have come across a few posts in the community (e.g. the following link) but none of these seem to be working for me.

https://community.servicenow.com/community?id=community_question&sys_id=82ef87a5dbdcdbc01dcaf3231f96...

 

(I thought this may provide some guidance too --> https://community.servicenow.com/community?id=community_question&sys_id=7bc00f65db98dbc01dcaf3231f96...)

If anyone can post  step by step guide in what needs to be done to achieve this/any help would be greatly appreciated!

Thanks,

Bas

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

you can handle this via script include function

script include:

var ConditionUtils = Class.create();
ConditionUtils.prototype = {
initialize: function() {
},

determineVisibility: function(){

if(gs.hasRole('admin'))
return true;
else
{
var gr = new GlideRecord("incident_task");
gr.addQuery("parent", current.sys_id);
gr.addEncodedQuery('active=true');
gr.query();
if (gr.next()) {
return false;
}
return true;
}
},

type: 'ConditionUtils'
};

call the function inside the condition field of both the UI actions:

new ConditionUtils().determineVisibility()

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thanks for you response Ankur.

I have found an alternative solution for the visibility of the UI button which meets our requirements, however thanks nonetheless for your suggestion.

Hi Basim,

Can you mark my answer as correct and helpful; it it helped.

Regards

Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Basim,

Any update on this?
Can you mark my answer as correct, helpful if you were able to achieve the requirement. This helps in removing this question from unanswered list and helps users to learn from your thread. Thanks in advance.

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader