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

@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

Medi C
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.

Oh, that's great! I originally did this in my relationship actually- I had it set up like you mentioned, using incident as my applies to table and my custom table as the queries from - 

 

current.addQuery("sys_id", parent.u_incident_details_data_center_ref

 

It actually did work, but then I second-guessed myself because I wasn't sure how it was populating the record from the relationship- but nice to know I'm not totally nuts! Do you know how it's pulling the record doing it this way?

thank you! 

 

Thinking I confused myself because that reference field isn't actually in the parent (custom) table. 

Yes, it is a bit confusing, but you simply need to think like you are adding a query to the table you are querying from (The custom table on your case). The parent is the table where the related list would be displayed (Incident in your case). If that was helpful, could you accept my solution?


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