Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

How to fetch all the records for table and provide to analyze in Now Assist Skill Kit

VaibhavP5059517
Giga Guru

I want to fetch all the records of a particular table rather than a single record of a particular table to provide as an input in script to analyze, is it possible or any alternative, if not.

5 REPLIES 5

sandeepdutt
Tera Patron

Hi @VaibhavP5059517 ,

 

You can use GlideRecord / GlideAggregate for a particular table, but the challenge is the if that table has millions of data, it will impact the Performance and can timeout while querying.

What i did was, Exported the data in a Excel sheet and then analyzed what is need.

Thanks,
Sandeep Dutta

Please mark the answer correct & Helpful, if i could help you.

Hey, I want to do the similar thing, I have created a dataset, do you know how to use this dataset in prompt

 
 

Screenshot 2026-02-24 143941.png

Tanushree Maiti
Tera Patron

Hi @VaibhavP5059517 

 

GlideRecord() with query(addQuery() or addEncodedQuery()) & using 'while' loop will return all the records from the table which you are querying dependent upon the query being matched

 

Sample Server-Side Script Example (GlideRecord)

Here is a common approach to retrieve all records and their data:

 
var tableName = 'incident'; // Replace 'incident' with your table name
var gr = new GlideRecord(tableName);// No addQuery() or addEncodedQuery() means it will fetch all recordsgr.query();

// Create an array to store the data
var recordsList = [];while (gr.next()) {
     var recordData = {};
    // Get specific field values and add them to the object
     recordData.number = gr.getValue('number');
    recordData.short_description = gr.getValue('short_description');
    recordData.assigned_to_display = gr.getDisplayValue('assigned_to');
    // Add more fields as needed    recordsList.push(recordData);
}gs.info("Total records fetched: " + recordsList.length);
Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

yashkamde
Giga Sage

Hello @VaibhavP5059517 ,

 

You can directly add a prompt for this in prompt editor - now assit skill kit :

ForrestFalk_28-1765556550384.png

 

If my response helped mark as helpful and accept the solution.