Related list on sc_req_item

Rajkumar Bommal
Tera Contributor

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 
 

RajkumarBommal_0-1740991412424.png

 

 


how can i archive that

1 ACCEPTED SOLUTION

@Rajkumar Bommal 

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.

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

View solution in original post

11 REPLIES 11

@Rajkumar Bommal 

 

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


Ankur Bawiskar
Tera Patron
Tera Patron

@Rajkumar Bommal 

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.

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

Ankur Bawiskar
Tera Patron
Tera Patron

@Rajkumar Bommal 

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);

related list ritm.gif

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

@Ankur Bawiskar 
Hi Ankur this was very helpful But i need to display this variable

RajkumarBommal_0-1741008376582.png

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 

@Rajkumar Bommal 

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.

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