Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Related List Not Displaying Reference Fields

kristenmkar
Mega Sage

Good evening! 🙂 

 

Thinking I may be overcomplicated things, as I have tried a few different methods to get a related list with records to display properly within incident. 

 

I currently have a reference field to a custom table built within incident. I have a business rule that populates this  reference field with the record response of the custom table when the incident is inserted, therefore linking them together:

 

incident details pg 2.PNGincident rule pg 1.PNG

I confirmed that the reference field displays the sys_id of the matching custom table record.  My issue is that I am trying to create a related list within incident to this related record.  For some reason I am unable to add the reference field to the related list - I added a custom related list entry for the Custom table using incident."ref field" and that worked within that table, but did not translate over to incident. 

 

I cannot figure out how to Query a related list where the sys_ids match - so the sys_ID of the reference field should match with the sys_id of the record in the custom table. I have created individual relationships, as well as related list entries - it currently is displaying all records no matter what I put as filter data and so far nothing has worked within incident. Wondering if I need an additional field on the custom table with the reference sys_id or something ?

 

issue with list.PNG

 

Let me know your thoughts! Any suggestions are appreciated! 

 

Thank you! 

1 ACCEPTED SOLUTION

Medi C
Giga Sage
Giga Sage

@kristenmkar

I have tried to do the same for "Problem" and "Incident". The incident has a reference field to the Problem table.
I created a custom relationship definition from System Definition > Relationships.

 

Applies to = "Incident"

Queries from: "your_custom_table" (Problem in this example)


As a script, you can do yours similar to the following: (Parent = Incident, Current = Problem) 

(function refineQuery(current, parent) {

	current.addQuery("sys_id", parent.problem_id); // Replace problem_id with your custom reference field

})(current, parent);

 

You can add then your custom related list to the incident form


MediC_0-1741048571709.png

I hope that would help!



If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.

View solution in original post

6 REPLIES 6

Great, that makes sense - glad to know what I also did wasn't crazy! Thanks so much! 

You are welcome! Glad I could assist.


If you found this helpful, please hit the thumbs-up button and mark as correct. That helps others find their solutions.