- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2024 11:05 PM
I need to write a script to show incident count for each state which are updated today and store in a custom field on Incident table
Do help me on the same
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2024 06:52 AM
I guess you are looking for the below image :-
If yes then please use the below code that will help you :-
Script :
gs.print('State\\tIncident Count');
var grIncident=new GlideAggregate('incident');
grIncident.addEncodedQuery(' sys_updated_onONToday@javascript: gs.beginningOfToday()@javascript: gs.endOfToday()');
grIncident.addAggregate('COUNT','state');
grIncident.query();
while(grIncident.next()){
gs.print(grIncident.state. getDisplayValue()+'\t'+grIncident. getAggregate('COUNT','state'));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2024 06:56 AM
Exactly I was looking for the same .
Thanks @Ravi Gaurav big fan of yours and your youtube channel.
Thanks a lot to answer all mu queries.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2024 06:32 AM
Hi @SandeepKSingh ,
I don't follow the requirement. Can you try to specify the use case?
if my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Best regards
Anders
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2024 06:52 AM
I guess you are looking for the below image :-
If yes then please use the below code that will help you :-
Script :
gs.print('State\\tIncident Count');
var grIncident=new GlideAggregate('incident');
grIncident.addEncodedQuery(' sys_updated_onONToday@javascript: gs.beginningOfToday()@javascript: gs.endOfToday()');
grIncident.addAggregate('COUNT','state');
grIncident.query();
while(grIncident.next()){
gs.print(grIncident.state. getDisplayValue()+'\t'+grIncident. getAggregate('COUNT','state'));
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2024 06:56 AM
Exactly I was looking for the same .
Thanks @Ravi Gaurav big fan of yours and your youtube channel.
Thanks a lot to answer all mu queries.