- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 12:43 AM
i Have created a catalog item
when it proceeded to sc_req_item table i want to display already created records with same variable value records in related lists
here is the demo for the realated lists
past compliments : spefify staff is catalog item variable
current req item record specify staff record also same so in related lists same specify staff records has been displaying
how can i archive that
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 05:46 AM
okay in related list you want to show the variable
check this link on how to add variable in related list
Article #19 - How to show Catalog Variables on RITM Lists
I hope I have answered your question and you can now enhance it further.
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
03-03-2025 04:02 AM - edited 03-03-2025 04:03 AM
Business Rule Script -
Trigger: Before Display
(function executeRule(current, gForm, gSNC) {
var gr = new GlideRecord('sc_req_item'); // Request Item table
gr.addQuery('u_specify_staff', current.u_specify_staff); // Match Staff
gr.addQuery('sys_id', '!=', current.sys_id); // Exclude the current record
gr.query();
if (gr.next()) {
current.addQuery('u_specify_staff', current.u_specify_staff);
}
})(current, gForm, gSNC);
✔️ If this solves your issue, please mark it as Correct.
✔️ If you found it helpful, please mark it as Helpful.
—
Shubham Jain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 04:04 AM - edited 03-03-2025 04:13 AM
this will work
Applies to table - Requested item
Queries from Table - Requested Item
Below will work if the variable is not within MRVS
(function refineQuery(current, parent) {
// Add your code here, such as current.addQuery(field, value);
var variableSysId = 'ee689d81db4b1e90727ee7dcd39619f5';
current.addQuery('variables.' + variableSysId, parent.variables[variableSysId]);
current.addQuery('sys_id', '!=' ,parent.sys_id); // to exclude the current RITM from showing in related list
})(current, parent);
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
03-03-2025 04:15 AM
working solution as per script I shared
(function refineQuery(current, parent) {
// Add your code here, such as current.addQuery(field, value);
var variableSysId = 'ee689d81db4b1e90727ee7dcd39619f5'; // give the sysid of that variable from item_option_new table
current.addQuery('variables.' + variableSysId, parent.variables[variableSysId]);
current.addQuery('sys_id', '!=' ,parent.sys_id); // to exclude the current RITM from showing in related list
})(current, parent);
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
03-03-2025 05:28 AM
@Ankur Bawiskar
Hi Ankur this was very helpful But i need to display this variable
variable name: specify staff
in related list and if multiple requests has been created by same specify staff variable i want to display all the related RITM records
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2025 05:30 AM
I already gave logic for same -> in related list and if multiple requests has been created by same specify staff variable i want to display all the related RITM records
what did you try and where are you stuck?
You can enhance for multiple variables using addQuery()
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