URL to Dependency View with Predefined Filter

IRana12334
Tera Contributor

I am trying to configure a UI Action on Incident Table that will open the dependency view of currently selected Configuration Item with a particular 'Predefined Filter'.  I can select the filter after opening the dependency view but I am unable to directly open dependency view with Predefined Filter.

 

Any suggestions will help.

 

Thanks.

3 REPLIES 3

Mark Manders
Tera Patron

Can you share the code you already have?

IRana12334
Tera Contributor

I haven't started coding yet. All I am looking for is the URL with the predefined filter.

The usual URL is in the below format:

 

https://my_snow_instance.service-now.com/$ngbsm.do?id=651a5937sc3e03403151a981ca9619f2&serviceView=t...

 

We can only see the sys_id's of 'Configuration Item' and 'FromTask' on this URL. When we select any predefined filter, the URL does not change.

IRana12334
Tera Contributor
This code should work. The only part I am missing is the end of script include which is in RED Color:
 
UI Action Code:
 
function OnDepViewClick(){
 
var srcsysid = g_form.getUniqueValue();
var ga = new GlideAjax('DepView');
ga.addParam('sysparm_name','geturl');
ga.addParam('sysparam_sysid', srcsysid);
ga.getXML(showPopup);
function showPopup(response) {
var Url= response.responseXML.documentElement.getAttribute("answer");
g_navigation.openPopup(Url);
}
}
 
Script Include:
 
var DepView = Class.create();
DepView.prototype = Object.extendsObject(AbstractAjaxProcessor, {
 
geturl: function() {
var srcsysid = this.getParameter('sysparam_sysid');
var gr = new GlideRecord('incident');
gr.addQuery('sys_id',srcsysid);
gr.query();
if(gr.next()){
var sd = encodeURIComponent(gr.short_description);
var cc = gr.description;
var desc = encodeURIComponent(cc) ;
url += gr.cmdb_ci+"^serviceView=true&sysparm_nostack=true&fromTask="+gr.sys_id;
 
}
return url;
},
 
    type: 'DepView'
});