- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 03:55 AM
Hi!
I have created the following script in Relationship:
I would like to display these in the related list, but no changes are displayed.
Can anyone please help me regarding it.
Thanks!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 07:03 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 04:00 AM
@DoDo labs___ Could you please update the script as follows and see if it works.
(function refineQuery(current, parent) {
var lista = '';
var tomb = [];
var gr = new GlideRecord('problem');
gr.addQuery('number', current.sys_id);
gr.query();
if (gr.next())
{
lista = gr.u_change_list;
}
tomb = lista.split(",");
for (var i = 0; i < tomb.length; i++)
{
current.addQuery('number', tomb[i]);
}
})(current, parent);
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 04:10 AM
Unfortunately, no changes have displayed yet.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 04:17 AM
Hi @DoDo labs___ ,
I think the issue is with the query-
Can you please try the below script-
(function refineQuery(current, parent) {
var lista = '';
var tomb = [];
var gr = new GlideRecord('problem');
gr.addQuery('number', current.sys_id);
gr.query();
if (gr.next()) {
lista = gr.u_change_list;
}
// Split the list of change requests
tomb = lista.split(",");
// Build the query for the related list
var changeGr = new GlideRecord('change_request');
var encodedQuery = '';
for (var i = 0; i < tomb.length; i++) {
if (i > 0) {
encodedQuery += '^OR';
}
encodedQuery += 'number=' + tomb[i];
}
if (encodedQuery) {
current.addEncodedQuery(encodedQuery);
}
})(current, parent);
If my response has resolved your query, please consider giving it a thumbs up and marking it as the correct answer!
Thanks & Regards,
Sanjay Kumar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2024 04:24 AM
@Community Alums Good catch.
@DoDo labs___ The script I suggested, is now updated based on Sanjay's suggestion.
(function refineQuery(current, parent) {
var lista = '';
var gr = new GlideRecord('problem');
gr.addQuery('number', current.sys_id);
gr.query();
if (gr.next())
{
lista = gr.u_change_list;
}
current.addEncodedQuery('numberIN'+lista);
})(current, parent);