Relationship Query script

SystemsGo
Tera Contributor

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?

SystemsGo_2-1745806917670.png

 

SystemsGo_1-1745806705309.png

 

 

 

 

11 REPLIES 11

@SystemsGo 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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?

SystemsGo_1-1745821225302.png

 

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

 

 

 

@SystemsGo 

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&colon;'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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@SystemsGo 

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.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur,

 

Thank you for your reply. 

Base on your solution:

 

javascript&colon; '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.