
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 02:58 PM
Hi. I am attempting to have the Predecessor and Successor of a task be displayed in a related list.
I created a Relationship under System Definition > Relationships so that I could add a Related List to our Project Task form. The related list is there and has the information I want, but it is not filtered to only show relationships associated with that Project Task.
Relationship details:
Applies to table : pm_project_task
Queries from table: planned_task_rel_planned_task
Query with:
(function refineQuery(current, parent) {
//current.addQuery('number', parent.parent);
current.addQuery('number', parent.child);
})(current, parent);
After creating the Relationship, I was able to Configure Related Lists, and it let me add it.
However, the related list shows every single Planned Task Relationship in the system, not just the ones related to that Project Task I have open. Here is a screenshot showing the related list, and that there are 1214 results;
I can manually filter the list down to what I want, but I would like the Related List to be filtered automatically, based on the Project Task you are viewing the Related List from.
Can anyone help with this?
Should I be using task_rel_task instead of planned_task_rel_planned_task in my relationship?
I've tried a few different script in the Relationship, but nothing had any affect.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 10:14 PM
Hi @JR42
It wont work to query on the number. you need to query the the parent or child using sys_id. If you want to list all predecessors and successors of a task you should be able to do something like the query below.
(function refineQuery(current, parent) {
current.addQuery('child', parent.sys_id)
.addOrCondition('parent', parent.sys_id);
})(current, parent);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2024 10:14 PM
Hi @JR42
It wont work to query on the number. you need to query the the parent or child using sys_id. If you want to list all predecessors and successors of a task you should be able to do something like the query below.
(function refineQuery(current, parent) {
current.addQuery('child', parent.sys_id)
.addOrCondition('parent', parent.sys_id);
})(current, parent);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2024 09:57 AM
Gustav, thank you! It's working great.