- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 02:10 PM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 02:56 PM
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..
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 09:22 PM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2025 09:30 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 02:56 PM
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..
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]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2025 01:22 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 08:49 PM
Hello @Zubair Alam
You need to create metric_definition on change_request table.
Refer the below screenshot -
Now after creating this metric definition I created a change request and made some changes in the assignment group field and they are being recorded.
You can always set the filter as created in last 12 months to get the groups you want for any particular change request.
Also you do reporting on this.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2025 09:22 PM
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.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader