The CreatorCon Call for Content is officially open! Get started here.

Can we show the related list records of one table into another table.

prashantA18
Tera Contributor

What I want is in problem table while creating the problem record there is one custom field Parent Incident which is referenced to Incident table.When I select the Incident record in the Parent Incident field and save the problem record then in related list of that problem record child incidents should be shown of that record selected in parent incident field.

1 ACCEPTED SOLUTION

@prashantA18 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@prashantA18 

you will have to create a defined relationship and use scripting in this table when you create new "sys_relationship"

Something like this

(function refineQuery(current, parent) {

    // Add your code here, such as current.addQuery(field, value);
    var parentIncident = parent.parent;
    var arr = [];
    var gr = new GlideRecord("incident");
    gr.addEncodedQuery("parent_incident=" + parentIncident + "^ORparent=" + parentIncident);
    gr.query();
    while (gr.next()) {
        arr.push(gr.getUniqueValue());
    }
    current.addQuery('sys_id', 'IN', arr.toString());

})(current, parent);

Then save this and add this related list on Problem Form in Your View -> Configure Related Lists

AnkurBawiskar_0-1739282373709.png

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@prashantA18 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader