Changing filter on related list.

John Snow1
Kilo Expert

I am testing the "Service Desk Call" Plugin. So far its pretty good. But I noticed in the related lists they have a list for "Tasks By Same Caller". This lists displays all Incidents, Problems, Changes by the same user. I would like to change this filter to display Incident,Problem,Change, and Ticket(TKT) since we use record producers to create Tasks with the type of Ticket. For the life of me I cannot figure out how to edit this related list. It shows "Tasks" in the filter like it is reporting off of the task table with no filter, but that is not the case. 

find_real_file.png

1 ACCEPTED SOLUTION

brandonboie
Mega Guru

The relationship that defines that Related List appears to be Tasks by Same Caller (big surprise, there). This URL should get you there (put in your own instance): https://[instance].service-now.com/nav_to.do?uri=%2Fsys_relationship.do%3Fsys_id%3Dded31ff1eb000100eac006a2f206feb1%26sysparm_record_target%3Dsys_relationship%26sysparm_record_row%3D2%26sysparm_record_rows%3D2%26sysparm_record_list

It seems to grab records from the Task table where caller is the found in the mini-queries that comprise the encoded query

find_real_file.png

 

Try shoe-horning in a query for your Ticket table. Here's what I came up with:

var callerID = parent.caller;
if( JSUtil.notNil(callerID) ) {
var inc = "sys_class_name=incident^active=true^ref_incident.caller_id="+callerID;
var prb = "sys_class_name=problem^active=true^opened_by="+callerID;
var chg = "sys_class_name=change_request^active=true^ref_change_request.requested_by="+callerID;
var scr = "sys_class_name=sc_request^active=true^ref_sc_request.requested_for="+callerID;
var tkt = "sys_class_name=ticket^active=true^ref_ticket.requested_by="+callerID;

current.addEncodedQuery(inc+"^NQ"+prb+"^NQ"+chg+"^NQ"+scr+"^NQ"+tkt);
}
else
    current.addEncodedQuery("sys_idISEMPTY");

 

In theory, this should grab all active records from the task table of class Incident, Problem, Change, Catalog Request, and Ticket where caller equals whatever fancy term is used on those records to denote 'belongs to this dude'

 

View solution in original post

5 REPLIES 5

yep should of thought to go to sys_relationships.list that worked fine just needed to change one piece which was "requested_by" in ticket its "opened_by" and in our instance we use "u_requested_for". Thank you sir