I want to find total no. of incidents which are having problem record and print those INC numbers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 03:05 AM
Please have a look on my script -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 03:09 AM - edited 12-19-2024 03:16 AM
Hi @Parth_S ,
var gr = new GlideRecord('incident');
gr.addEncodedQuery('problem_id!=NULL');
gr.query();
gs.print('found');
while(gr.next()){
gs.print('INC are: ' + gr.number);
}
Above script working fine for me. You dont have problem record attached to incident.In List view add problem record to problem column for incident record it will show output.
If my response helped, please mark it as the accepted solution ✅ and give a thumbs up👍.
Thanks,
Anand
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 03:17 AM
Hii @Anand Kumar P,
After adding filter that Problem -> is not empty, i am able to see 23 records in list view.
And to all those incidents, problem record is attached.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 03:20 AM
Still you are not able to see the records in Background script?
Above screenshots you can see which i attached working as expected.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 09:31 AM
Hi @Parth_S ,
what is the business requirement since you’re scripting?
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/