Adding a related list for a scoped application

sharonjanisch
Tera Contributor

We have a scoped application to track security exceptions that are created for users.     The table for the application is extended from Task and Requested By is the field that specifies the user for whom the exception was created.

I want to add a related list to the Incident form that will display any security exception records for the caller.       I've created a relationship.   Applies to table is set to Incident.   Queries from table is set to the Security Exceptions table.   Below is what I have in the Query with but that display all the exceptions for every user - not just the current caller on the incident.     What do I have wrong here?

(function refineQuery(current, parent) {

current.addQuery('caller_id','requested_by')

})(current, parent);

1 ACCEPTED SOLUTION

I was just re-reading the docs. Try switching the query around.



current.addQuery('requested_by', parent.caller_id);


View solution in original post

7 REPLIES 7

Chuck Tomasi
Tera Patron

Try this instead:



(function refineQuery(current, parent) {


current.addQuery('caller_id', parent.requested_by);


})(current, parent);



http://wiki.servicenow.com/index.php?title=Creating_Defined_Related_Lists#gsc.tab=0


sharonjanisch
Tera Contributor

Hi Chuck - I tried that and still get a list of all the exceptions and not just the ones for the current caller.  


Hi Sharon,



Can you share a screenshot of the entire defined relationship record? Thanks.


sharonjanisch
Tera Contributor

Sure - here it is.


find_real_file.png