How to extract information from additional information column of a catalog item

Community Alums
Not applicable

Hello Team,

I am trying to extract content users have input in the additional column of a catalog item into a report. Please note the variable is HTML type and its not mapped to any field 

1 ACCEPTED SOLUTION

Nilesh Pol
Tera Guru

@Community Alums If you're just exploring values, run this in Background Scripts to verify.

var gr = new GlideRecord('sc_req_item');
gr.query();

while (gr.next()) {
var htmlVar = gr.variables.additional_info; // Replace with your variable name
if (htmlVar) {
gs.print('Requested Item: ' + gr.number + ' | HTML Content: ' + htmlVar.toString());
}
}

OR you can create REPORT on a variable via the sc_item_option_mtom table

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@Community Alums 

whenever RITM is submitted data for the variables is stored in Variable Ownership table [sc_item_option_mtom] and Options[sc_item_option]

But remember it will store the data in plain text and since your variable is HTML type, it will store in plain text itself

something like this

AnkurBawiskar_0-1746683379132.png

 

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

Nilesh Pol
Tera Guru

@Community Alums If you're just exploring values, run this in Background Scripts to verify.

var gr = new GlideRecord('sc_req_item');
gr.query();

while (gr.next()) {
var htmlVar = gr.variables.additional_info; // Replace with your variable name
if (htmlVar) {
gs.print('Requested Item: ' + gr.number + ' | HTML Content: ' + htmlVar.toString());
}
}

OR you can create REPORT on a variable via the sc_item_option_mtom table

Community Alums
Not applicable

Thank you Nilesh. How do i direct it to a specific catalog item, i want it to extract the information from

@Community Alums here is code for directing it to a specific catalog item


var catItemSysId = '1234567890abcdef1234567890abcdef';  //catalog item's sys_id

var reqItemGR = new GlideRecord('sc_req_item');
reqItemGR.addQuery('cat_item', catItemSysId);
reqItemGR.query();

while (reqItemGR.next()) {
var htmlInput = reqItemGR.variables.additional_info; // Replace with your variable name
if (htmlInput) {
gs.print('REQ# ' + reqItemGR.number + ' | Input: ' + htmlInput.toString());
}
}