Relationship Query script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2025 07:22 PM
Hi Experts,
I've created a table called (u_asset_entilement) to display on the incident to entitle asset to user from incident table as attached screen shot.
Is there any way to only display the assets belongs to the company which is the same as the company of incident form?
I've created a relationship Query script, but seems not correct.
How to user relationship query script to narrow down the asset list?
In another hand, is there any other way to implement this requirement besides the relationship query script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2025 11:05 PM
the new table "u_asset_entilement" has u_asset field
which other field does it have?
I believe you should have a incident field on that table "u_asset_entilement" and show it as related list ( you can add this OOTB and no defined relationship required)
Then when you click new button in related list, you will have a new record with INC populate
Then you can filter the assets on that form based on the INC Company->Asset
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
04-27-2025 11:28 PM
Hi Ankur,
Thank you so much for your help on this requirement.
You are correct, in the table "u_asset_entilement" there are 3 fields like below.
If I would like to display the list on incident form, not in the related list? Can that be implemented?
I've created a user in my instance. Could you help on this requirement?
instance: https://dev314707.service-now.com/
User Id: test.user
Password: WLa<b-0vR]R]dd[:6yc[RFVi4><d^^:xP2QWg#&8mb8XiR)H&=FE9Z+l?tr<lZ?@BZ0Yo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-27-2025 11:33 PM
Sorry but I can't login to the PDI due to restrictions
Since you already have the field i.e. INC on your table you can use that to filter the assets
something like this in advanced ref qualifier of u_asset
javascript:'companyIN' + current.u_incident.company;
I believe I have answered your question.
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
05-04-2025 08:55 AM
Hope you are doing good.
Did my reply answer your question?
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
05-05-2025 06:10 PM
Hi Ankur,
Thank you for your reply.
Base on your solution:
javascript: 'companyIN' + current.u_incident.company;
How to match the current.sys_id and current.u_incident when I try to insert a record to this customized table?
Because when I create a new record the u_incident hasn't been set value, so how to set the value before I input value to field u_asset?
Thank you.