Number of Change Tickets Assigned to active groups in last 12 months

Zubair Alam
Tera Contributor

Hello Enthusiasts!
How can we fetch the list of groups that were assigned a change ticket in the last 12 months?

All help is greatly appreciated. Thanks.

3 ACCEPTED SOLUTIONS

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Zubair Alam 

Your requirement is not entirely clear. Do you want to see how many changes have been assigned to the group in the last 12 months, or am I mistaken? If it's the first case, then..

 

AGLearnNGrow_0-1742594171071.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

Ankur Bawiskar
Tera Patron
Tera Patron

@Zubair Alam 

use this in background script

var gr = new GlideRecord('change_request'); // Table for change requests
gr.addEncodedQuery('sys_created_on>=javascript:gs.beginningOfLast12Months()'); // Filter for the last 12 months
gr.query();

var groups = {};
while (gr.next()) {
    var group = gr.assignment_group.getDisplayValue();
    if (group) {
        if (!groups[group]) {
            groups[group] = 0;
        }
        groups[group]++;
    }
}

// Print the results
for (var groupName in groups) {
    gs.info(groupName + ': ' + groups[groupName] + ' change tickets');
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

View solution in original post

Shivalika
Mega Sage

Hello @Zubair Alam 

 

 

Please confirm if you checked my answer. Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for my efforts and also it can move from unsolved bucket to solved bucket. 

 

Regards, 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeE

View solution in original post

7 REPLIES 7

@Zubair Alam 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Thanks for the help @Ankur Bawiskar 

Shivalika
Mega Sage

Hello @Zubair Alam 

 

 

Please confirm if you checked my answer. Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for my efforts and also it can move from unsolved bucket to solved bucket. 

 

Regards, 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeE