- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 07:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 07:16 AM
Hello @Neerudus
You can use Background script to print 10 problem records data.
Use the below script and run it in background script, you can add the conditions you want if needed.
Regards,
Rathan K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 07:16 AM
Hello @Neerudus
Please refer the script below:
var gr = new GlideRecord('problem');
gr.orderByDesc('sys_created_on');
gr.setLimit(10);
gr.query();
var count = 0;
while (gr.next()) {
count++;
gs.print("problem #" + count + ":\nNumber:" + gr.number + "\nCreated On: " + gr.sys_created_on.getDisplayValue() + "\n");
}
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 07:12 AM
Hello @Neerudus
var problemGr = new GlideRecord('problem');
problemGr.addQuery('active', true); // Optional: filter for active problems
problemGr.setLimit(10); // Limit to 10 records
problemGr.query();
gs.print('--- Displaying 10 Problem Records ---');
while (problemGr.next()) {
gs.print('Problem Number: ' + problemGr.number +
', Short Description: ' + problemGr.short_description +
', State: ' + problemGr.state.getDisplayValue() + // Get display value for choice fields
', Assigned To: ' + problemGr.assigned_to.name // Get name for reference fields
);
// You can add more fields as needed, e.g.:
// gs.print('Description: ' + problemGr.description);
// gs.print('Category: ' + problemGr.category);
}
gs.print('--- End of Problem Records ---');
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 07:50 AM
@Neerudus
Any issue with my solution?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 07:16 AM
Hello @Neerudus
You can use Background script to print 10 problem records data.
Use the below script and run it in background script, you can add the conditions you want if needed.
Regards,
Rathan K
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-16-2025 07:16 AM
Hello @Neerudus
Please refer the script below:
var gr = new GlideRecord('problem');
gr.orderByDesc('sys_created_on');
gr.setLimit(10);
gr.query();
var count = 0;
while (gr.next()) {
count++;
gs.print("problem #" + count + ":\nNumber:" + gr.number + "\nCreated On: " + gr.sys_created_on.getDisplayValue() + "\n");
}
Hope this helps!
"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"
Thank You
Juhi Poddar