- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team,
I need assistance in creating a custom relationship between the sc_task and alm_asset tables in ServiceNow.
The requirement is as follows:
1. The relationship should display only the assets selected in the item variables of the sc_task record.
2. The related list should dynamically filter and show only the selected assets based on this variable value.
I attempted to achieve this using a relationship query, but it is currently not working as expected. Kindly guide me on how to configure the relationship so that the selected asset appears correctly in the related list.
Thanks & Regards,
Madhu.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
this will work fine provided your variable is referring to alm_asset table
var ritmRecord = parent.request_item.getRefRecord();
var assetSysId = ritmRecord.variables.variableName; // give your variable name here
current.addQuery('sys_id', assetSysId);
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
3 weeks ago
this will work fine provided your variable is referring to alm_asset table
var ritmRecord = parent.request_item.getRefRecord();
var assetSysId = ritmRecord.variables.variableName; // give your variable name here
current.addQuery('sys_id', assetSysId);
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