sc_req_item & request_item

ashleygreens
Giga Contributor

Hi Folks,

I have a question regarding Service catalog. I am trying to understand the difference between

sc_req_item     & request _item.   Can someone explain me the difference between the two.

Thanks,

Ashley

1 ACCEPTED SOLUTION

Hi Ashley,



The request_item is a column name in sc_item_option_mtom table which takes sys_id of the RITMs. That will help to filter out the GlideRecord of sc_item_option_mtom table to extract the data of a particular related records.


View solution in original post

14 REPLIES 14

Hi Ashley,



As per my understanding sc_item_option_mtom table is a relation between sc_req_item and sc_item_option tables which allows you to get the list of RITMS being updated for any particular variable with any specific value.



sc_req_item: Contains the record of RITMS


sc_item_option: contains the variables being updated with what values.




Now the below code.


var gr = new GlideRecord('sc_item_option_mtom'); // We are doing the GlideRecord on sc_item_option_mtom which is having a relationship between sc_req_item and sc_item_option tables


gr.addQuery('sc_item_option.item_option_new.name','item_name'); // Here we are providing the name of the variable. sc_item_option is a reference field which holds the the updated variables records, so we are passing the name of the variable which was updated


gr.addQuery('sc_item_option.value','item_value'); // Here we are providing the value of the variable which was updated


gr.query();  


while(gr.next())


{ gs.addInfoMessage(gr.request_item.number); } // this will give you name of the RITMS which meets the above Query criteria




I ran the below script in background script and got the result.


var gr = new GlideRecord('sc_item_option_mtom');


gr.addQuery('sc_item_option.item_option_new.name','Client'); //variable name is Client


gr.addQuery('sc_item_option.value','AT&T'); //Variable value is AT&T


gr.query();  


while(gr.next())


{ gs.log(gr.request_item.number); }



Result:


List of RITMs in which Client variable was updated with value AT&T


find_real_file.png


Hope this helps.


Thank you so much XXX


Hi Ashley,



If I have answered your questions, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.



If you are viewing this from the community inbox you will not see the correct answer button.   If so, please review https://community.servicenow.com/docs/DOC-5601


Harsh Vardhan
Giga Patron

sc_req_item is a table name of "Requested Item.



when ever you submit a request it create "Request" (sc_request) and every request would have multiple Requested Item.


req_item is not a table. from where did you get this name?



Please refer the link below.



Introduction to Service Catalog - ServiceNow Wiki


Thanks Tim, much appreciated. If you see the below comment where harsh has updated req_item, is it the same ?



Thanks harsh vardhan.