- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2023 03:25 AM
how to display the list of child incidents only on parent incidents.
and hide the list of child incidents on non parent incidents.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2023 03:49 AM
Hi @rampage
Let's try below approach.
1. Create a Client Callable Script Include to validate if the current record is a parent incident.
Sample below
var CLIncidentUtils = Class.create();
CLIncidentUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isParentIncident: function(){
var incidentID = this.getParameter('sysparm_incident_id');
var grIncident = new GlideRecord('incident');
grIncident.addQuery('parent_incident', incidentID);
grIncident.query();
return grIncident.hasNext();
},
type: 'CLIncidentUtils'
});
2. Create OnLoad Client Script to hide the Related List Child Incidents accordingly.
function onLoad() {
var ga = new GlideAjax('global.CLIncidentUtils');
ga.addParam('sysparm_name', 'isParentIncident');
ga.addParam('sysparm_incident_id', g_form.getUniqueValue());
ga.getXMLAnswer(function(response) {
alert(response);
if (!response) {
g_form.hideRelatedList('incident.parent_incident');
}
});
}
Let me know if it works for you.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2023 03:49 AM
Hi @rampage
Let's try below approach.
1. Create a Client Callable Script Include to validate if the current record is a parent incident.
Sample below
var CLIncidentUtils = Class.create();
CLIncidentUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isParentIncident: function(){
var incidentID = this.getParameter('sysparm_incident_id');
var grIncident = new GlideRecord('incident');
grIncident.addQuery('parent_incident', incidentID);
grIncident.query();
return grIncident.hasNext();
},
type: 'CLIncidentUtils'
});
2. Create OnLoad Client Script to hide the Related List Child Incidents accordingly.
function onLoad() {
var ga = new GlideAjax('global.CLIncidentUtils');
ga.addParam('sysparm_name', 'isParentIncident');
ga.addParam('sysparm_incident_id', g_form.getUniqueValue());
ga.getXMLAnswer(function(response) {
alert(response);
if (!response) {
g_form.hideRelatedList('incident.parent_incident');
}
});
}
Let me know if it works for you.
Cheers,
Tai Vu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2023 08:43 AM
I made a small change, if (response == 'false') and it worked perfectly...THANK U SO MUCH