We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to write where clause in database join to check if work notes CONTAIN 'value1' or 'value2'

Snehal13
Kilo Sage

How to write where clause in database join to check if work notes CONTAIN 'value1' or 'value2'

6 REPLIES 6

Hi @Snehal13 Use belwo script 

var gr = new GlideRecord('incident'); 
gr.addEncodedQuery('work_notesLIKEexecuted the script^ORwork_notesLIKEdeployed the script');
gr.query();

while (gr.next()) {
    var category = gr.category;  
    var state = gr.state;        
    var workNotes = gr.work_notes;
    
    // Output or process the result as needed
    gs.info('Incident Number: ' + gr.number + ', Category: ' + category + ', State: ' + state);
}

Can I export the output result in an XLS sheet after running this script