- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 11:05 AM
Hello! Looking to add a related list to Users to show what RITMs they've requested. Creating the Relationship and adding it to users is easy enough. But it looks like I need to add "Query with" in the relationship, otherwise it just shows all RITMs in the related list within the user record.
I believe I'll need to query the RTIMs "requested for", but kind of lost from there. Any guidance would be great!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 04:57 PM
Hey @VernYerem,
No need to create a new relationship here, use the Requested Item > Requested For from the available list.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 04:53 PM
HI @VernYerem
you need to create a new relationship and add query on the requested for field. The OOB field uses requested_for
Check your RITM or REQ for the correct user field and add this line to the query
Thanks
Hope this helps. Please mark the answer as correct/helpful if this solves your issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 04:57 PM
Hey @VernYerem,
No need to create a new relationship here, use the Requested Item > Requested For from the available list.
Cheers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 01:51 PM
Ah! Best answer, it's already there and I was searching for the incorrect terms. Thanks @James Chun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2024 05:23 PM
Hi @VernYerem ,
ou can use "Defined Related List" for your requirement. You can follow below steps
Goto System Definition > Relationships
Click New
Set valid name for your related list
Set Applies to table as sc_request table
Set Queries from table as sys_user table
Use the below code in "Query with"
var group = []; var grTask = new GlideRecord("sc_task"); grTask.addQuery("request_item",parent.sys_id); grTask.query(); while(grTask.next()){ group.push(grTask.assignment_group.sys_id.toString()); } var users = []; var grUser = new GlideRecord("sys_user_grmember"); grUser.addEncodedQuery("groupIN" + group.join(",")); grUser.query(); while(grUser.next()){ users.push(grUser.user.sys_id.toString()); } current.addEncodedQuery("sys_idIN"+users.join(","));
If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!
Thanks & Regards,
Sumanth Meda