- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 04:48 AM
Good Day Community
I am currently trying to create a related list on the Portfolio table.
This is my requirement:
- On the Project form there is currently a related list named "Actions".
- When a user creates an Action on the project form and the project is associated to a Portfolio then the actions on the project record should roll up to the Portfolio record.
This is what I have attempted thus far:
This is the related lists on the Portfolio record. I have created the Related List named Project Actions. Currently all actions are displaying. I only want actions associated to the specific Portfolio to display
Is there a way to achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 05:16 AM
I hope this will work for you as it worked for me
Please enhance as per your requirement
(function refineQuery(current, parent) {
// Add your code here, such as current.addQuery(field, value);
var projectArr = [];
var gr = new GlideRecord("pm_m2m_portfolio_project");
gr.addQuery("portfolio", parent.sys_id);
gr.query();
while (gr.next()) {
projectArr.push(gr.project.pm_project.toString());
}
current.addQuery('parent', 'IN', projectArr.toString());
})(current, parent);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 06:54 AM
Thank you so much @Ankur Bawiskar this worked!