Creating a Related List that matches on a field on a different table that contains value

bpolo
Tera Guru

We have a table where it has a field called "ID". We have a second table where there is a field called  "Vulnerability" that contains the value of the ID field (it is not equal to the ID field of the first table). Is there a way to create a Related list on the first Table that shows all the records of the second table that contain the ID value in the Vulnerability field?
Thanks in advance!

1 ACCEPTED SOLUTION

Hi @bpolo ,

 

you can add a encoded query something like below,

 

current.addEncodedQuery('sys_id!='+parent.getValue('sys_id')+'^descriptionLIKE'+parent.description)

 

 

or If you want to check contains then you can try something like below,

 

current.addQuery('descriptionLIKE' , parent.description);

 

 

These are just example please change it according to your requirement.

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

View solution in original post

4 REPLIES 4

swathisarang98
Giga Sage
Giga Sage

Hi @bpolo ,

 

I have done something like this for change and release table,

 

You can create a Relationship 

System definition -> Relationship 

 

please refer below ,

 

swathisarang98_2-1709846578793.png

 

Here current belongs to Queries from Table , so in change table there should be reference record which is capturing release record number (reference field)

 

Parent is release table record so we have to query something like below

 

current.addQuery('u_release_record.number', parent.number);

 

So Related list will be created for 'Applies to table' which is release.

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

Hi Swathi 

Thanks very much for your response! Do you know how we could code the query to check for contains a value instead of equal to a value. Thanks!

Hi @bpolo ,

 

you can add a encoded query something like below,

 

current.addEncodedQuery('sys_id!='+parent.getValue('sys_id')+'^descriptionLIKE'+parent.description)

 

 

or If you want to check contains then you can try something like below,

 

current.addQuery('descriptionLIKE' , parent.description);

 

 

These are just example please change it according to your requirement.

 

Please mark this comment as Correct Answer/Helpful if it helped you.

Regards,

Swathi Sarang

Thanks so much, Swathi!