Detect Orphaned Assignment Groups

JinkaH
Tera Contributor

How to detect and identify orphaned assignment groups  in Incident if the group is inactive and no groupmembers present in the group table 

6 ACCEPTED SOLUTIONS

@JinkaH 

Can you close this thread as its different requirement. You can open new thread with proper requirement use case .  I will see and check and try to help.

 

Thanks and Regards,

Mohammed Zakir

View solution in original post

@JinkaH 

service desk mean incident ticket? can u state requirements.

You can post a new question, detail it out properly

 

Regards,

Zakir 

View solution in original post

@JinkaH 

If iam understanding is correct:

1) Get group with Zero members.

2)Reassign all the tickets of these group to other active group with user, so which is this group?

3) why flow designer? is it specific requirement. 

4) what's the trigger daily, weekly?

 

This will take time to build in PDI, i suggest you to post as new question in developer forum so other can have their inputs too,

 

Regards,

Mohammed Zakir

 

View solution in original post

@JinkaH 

You are right to go to flow designer as approach.

I was just  asking if it was specific business requirement to use as flow designer.

Other approach i can think is Schedule jobs.

 

Regards,

Mohammed Zakir

View solution in original post

Hi @JinkaH 

If you want to use less code or a no-code solution, the Flow Designer is the best option.

*************************************************************************************************************
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

Hi @JinkaH 

My basic video will be helpful for understanding the Flow Designer process.

 

https://youtu.be/IRSPf3_Wq-o

*************************************************************************************************************
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

CISITSM #ITSM #csa #ServiceNow #TechnoFuncational Disclaimer: These videos are from my training batch. These videos did not promote any ServiceNow Sales pitch or marketing. These videos are only for knowledge purposes & basic on my experience & Knowledge. Redistribution or copying of functionality
18 REPLIES 18

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @JinkaH 

 

There’s no direct way to do this other than using some background script.

Create a report on the Group table and then check the members.

 

 

 

then on incident report :

DrAtulGLNG_0-1764671765216.png

 

 

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0695912

 

*************************************************************************************************************
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]

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

HI @JinkaH 

 

Did you check my response?

*************************************************************************************************************
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]

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

Mohammed8
Giga Sage

Hi @JinkaH ,

Your use case has two requirement:

1)Inactive group AND 2) No group member

 

I have used background script

 

var orphanGroups = [];

var printed = false;

// 1. Aggregate member count per group (only sys_id → count)

var memberCount = {};
var agg = new GlideAggregate("sys_user_grmember");
agg.groupBy("group");
agg.addAggregate("COUNT", "user");
agg.query();

while (agg.next()) {

    memberCount[agg.getValue("group")] = parseInt(agg.getAggregate("COUNT", "user"));

}
// 2. Loop inactive groups + detect count = 0
var g = new GlideRecord("sys_user_group");
g.addQuery("active", false);
g.query();

while (g.next()) {
// If NOT present in memberCount → means count is 0

    var count = memberCount[g.getUniqueValue()] || 0;

    if (count === 0) {

        if (!printed) {

            gs.print("Orphaned groups found:");

            printed = true;

        }
  gs.print(" → " + g.getDisplayValue("name"));

        orphanGroups.push(g.getUniqueValue());

    }

}
// 3. Final single list URL
if (orphanGroups.length > 0) {

    var url = gs.getProperty("glide.servlet.uri") +

        "sys_user_group_list.do?sysparm_query=sys_idIN" +

        orphanGroups.join(",");

gs.print(
"List URL: " + url);

} else {

    gs.print("No orphaned groups found");

}

Script Result:

 

Mohammed8_0-1764673961315.png

 

Result Verification:

 

Mohammed8_1-1764674043497.png

 

If you find this answer useful, please mark it as solution accepted/helpful.

 

Thanks and Regards,

Mohammed Zakir

JinkaH
Tera Contributor

hi @Mohammed8 could you please help me with the solution of flow designer and i want to detect the groups and route that groups to service desk