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

Ankur Bawiskar
Tera Patron
Tera Patron

@SystemsGo 

how is the Asset field added on form? that field refers to which table? alm_asset?

Is it an embedded list? If yes then that's not how your relationship query script will work

If it's field on incident form then it should work fine

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.

I added the table(u_asset_entilement) list to incident form as below.

 

I know, maybe the relationship is not correct for this requirement. Is there any other solution can implement my requirement? (Only display the asset list belong to the company in the incident form?)

SystemsGo_0-1745818797941.png

 

@SystemsGo 

so it's an embedded list as I thought earlier.

what's your business requirement actually here?

You want to see the related list -> if yes then on u_asset_entilement table are you using the correct field

in your addQuery() it should be u_asset and not asset

current.addQuery('u_asset.company', parent.company);

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

Business Requirement is:

Support Center can add multiple assets to this incident form to assign assets to different users.

That's why I created a new table(u_asset_entilement) to record these entitlement.

but when they click the magnifier button to select asset from alm_asset table, hope this list can only display the asset list which belongs to specific (the company in the incident form) company like below screen shot.

SystemsGo_0-1745819665207.png

Is there any way can implement this?