How do I create a related list for the INC/PRB table?

matthew_magee1
Giga Guru

SN Community-

I've been thrown into the world of PRB/CHG/INC tickets.

One task that was asked is:

Please create a related list on the INC which shows the associated PRB.

Now there is already a field under Related Records for the problem:

Capture.PNG

This is sufficient, BUT the customer would like a related list tab showing the same problem.

I started off by creating a Relationship

Applies to table: Incident

Queries from table: Problem

Queries with: current.addQuery(sys_id, parent.problem_id);

When I add this related list to the Incident form, I do get the associate problem with the INC, but I also get ALL problems, not just the one associated with the parent INC

I'm guessing the Queries with statement is incorrect.

Am I close to getting what I need?

Note: the variable 'problem_id' on the INC form is a reference field to the Problem table. I thought by getting the sys_id (parent.problem_id) and matching it with the sys_id of the problem, I'd get the result I need

Any help is greatly appreciated-

1 ACCEPTED SOLUTION

Mike Allen
Mega Sage

Your addQuery has no ticks:



current.addQuery('sys_id', parent.problem_id);


View solution in original post

6 REPLIES 6

Govind Kumar S1
Kilo Guru

Hi Matthew,



I think their is no need to create new relationship here.. OOB we have same functionality.



go to configure->related list. search for problem task->parent and move it to selected slushbucket.



Thanks & regards


Govind Kumar Sharma


Brian Dailey1
Kilo Sage

Hi Matthew,



See Mike's first post for the correct answer (use the existing related list available "Problem-->Parent").



However, one note on your original query.   Invalid query conditions are by default ignored and will return all records.



To avoid this, either:


  1. use "gs.getSession().setStrictQuery(true);" in your scripts prior to querying a GlideRecord
  2. or set your system property:     glide.invalid_query.returns_no_rows = true



Thanks,


-Brian