Relationship(related list) in service now
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2024 07:03 AM
Hello all,
For a particular catalog item, I need to show a related list "Users" which must fetch the active users that are present in the job role (fetched from the catalog task) so I've written a relationship code which applies to catalog task and queries from User job role mapping table but it doesn't work. Can someone help me debug this?
(function refineQuery(current, parent) {
var gr = new GlideRecord("sc_req_item");
gr.addQuery('cat_item', '2ab8ba036fb99200b7b61abf1e3ee4eb');
gr.query();
if (gr.next()) {
current.addQuery('u_job_role', parent.request_item.variables.Job_Position);
current.addQuery('u_active', true);
current.addQuery('u_user.active', true);
}
})(current, parent);