How to print active incidents through glide record?

Srinivas snow28
Tera Contributor

How to print active incidents through glide record?

2 REPLIES 2

Sandeep Rajput
Tera Patron
Tera Patron

@Srinivas snow28 Here is the sample script for you.

 

var gr = new GlideRecord('incident');   // Create a new GlideRecord object for the 'incident' table
gr.addActiveQuery();                    // Add a query to return only active incidents
gr.query();                             // Execute the query

while (gr.next()) {                     // Loop through each record returned by the query
    gs.print('Incident Number: ' + gr.getValue('number'));    // Print the Incident Number
    gs.print('Short Description: ' + gr.getValue('short_description')); // Print the Short Description
    gs.print('Assigned To: ' + gr.getDisplayValue('assigned_to'));      // Print the Assigned To (display value)
    gs.print('---');    // Print a separator between incidents
}

 

Please mark the response helpful and accepted solution if it addresses your question.

Ankur Bawiskar
Tera Patron
Tera Patron

@Srinivas snow28 

It should be an easy task.

What did you start with and where are you stuck?

Unless you start you won't be able to learn.

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