Make Resolution Information section visible only when incident/request created

Pandu3
Tera Contributor

Hi Team,

 

I have a requirement , when incident/request created to related Case then only make visible resolution information section on case record. If incident not created then I need to make invisible entire resolution information section and if request created then I need to make resolution information section visible but under this section I need to hide "Resolution Code" field. Can anyone help me on this requirement . Thanks in advance.

 

 Case have either Incident or Request only

 

Pandu3_0-1683713741294.png

 

1 ACCEPTED SOLUTION

Dear @Pandu3 

Please use the below :

1. Client Script On Load  on the case request

var gaRequest = new GlideAjax('checkParentExists');
gaRequest.addParam('sysparm_name', 'getParent');
gaRequest.addParam('sysparm_parent', g_form.getUniqueValue());
gaRequest.getXMLAnswer(checkParent);
function checkParent(answer) {
alert(answer);
if(answer == 'true'){
g_form.setSectionDisplay('resolution_information',true);
g_form.setVisible('resolution_code',false);
}else{
g_form.setSectionDisplay('resolution_information',false);

}
}

 

Script Include - client callable

var checkParentExists = Class.create();
checkParentExists.prototype = Object.extendsObject(AbstractAjaxProcessor, {
 
getParent : function(){
var result;
var CaseSysId = this.getParameter("sysparm_parent");
 
        var grRequest = new GlideRecord('sc_request');
        grRequest.addQuery("parent", CaseSysId);
grRequest.query();
if(grRequest.next()){
result = "true";
}else{
result = "false";
}
        return result;
},
 
    type: 'checkParentExists'
});
 
KB18_0-1683876435995.png

 

Please hit the thumb Icon and mark as correct in case I help you with your query!!!
- Kailas

View solution in original post

11 REPLIES 11

Jori
Giga Guru

tested with UI policy the first requirement (if no inc, hide the tab)
condition: incident field is empty (related record field 'Incident(incident)' )

JoriSimola_0-1683717648492.png

script

JoriSimola_1-1683717672727.png

result

JoriSimola_2-1683717693366.png

rule inactive:

JoriSimola_3-1683717725131.png

modify the condition to include the request 🙂 hope this helps

Pandu3
Tera Contributor

Hi Jori Simola,

 

Thanks for your quick replay.

I already implemented the first condition it's working .

Need help on second condition.

Good to know it helped 🙂 please elaborate the resolution code hiding idea. are you going to sync the code with some business rule from the request after the request is completed, if it needs to stay hidden? 

Pandu3
Tera Contributor

My exact requirement was, While new case creation need to hide the Resolution information section. After incident/ Request creation then only need to show Resolution information section.

 

if incident created then need to show entire section and no need to hide any fields.

if Request created then need to show entire section but I need to hide Resolution code field under Resolution information section.

 

NOTE: If I create the request then it will create the Case automatically.

  • Case(parent)--->Request or Case(parent)--->Incident.

 Thanks.

Pandu3_1-1683865989333.png