Need Refine Query for related list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2019 05:19 AM
Hi ,
TASK:I have a parent table(portfolio) with the related list (project),now need to create another related list (action)depend on projects field in existing related list field
Thanks in advance!
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-24-2019 04:59 PM
Build a Relationship under System Definition, have it query from the action table and apply to the portfolio table. In the script, query project where parent = parent.sys_id (which is the portfolio). Something like this:
(function refineQuery(current, parent) {
// Add your code here, such as current.addQuery(field, value);
var proj_list = '';
var proj = new GlideRecord('pm_project');
proj.addQuery('parent', parent.sys_id);
proj.query();
while(proj.next()){
proj_list += proj_list == '' ? proj.sys_id : ',' + proj.sys_id;
}
current.addQuery('parent', 'IN', proj_list);
})(current, parent);