Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Related List Script - Help

LuizM0098939804
Kilo Explorer

Hello, everyone!

I am having trouble syncing the incident table with an internal table u_escalation_control. I basically need to filter the related list; both the incident and escalation records have the field "Company", both inheriting from core_company.

The AI gave me several alternatives and codes, but it's not working. The related list pulls all records without filtering.

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@LuizM0098939804 

I believe you created a Defined Relationship between RITM and Your Escalation Control table

Applies to RITM

Queries from: Escalation Control

Query With: update as this

(function refineQuery(current, parent) {

    // Add your code here, such as current.addQuery(field, value);

    current.addQuery('u_company', parent.company); // give correct company field present on escalation control in place of u_company

})(current, parent);

AnkurBawiskar_0-1764091253756.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

View solution in original post

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@LuizM0098939804 

I believe you created a Defined Relationship between RITM and Your Escalation Control table

Applies to RITM

Queries from: Escalation Control

Query With: update as this

(function refineQuery(current, parent) {

    // Add your code here, such as current.addQuery(field, value);

    current.addQuery('u_company', parent.company); // give correct company field present on escalation control in place of u_company

})(current, parent);

AnkurBawiskar_0-1764091253756.png

 

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

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

Thank you very much, Ankur!