Empty Groups are getting created
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2018 09:44 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2018 09:48 PM
Hi
Can you check for some business rule written. I think that is the problem groups are getting created.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2018 09:50 PM
Check the below link too.
It maybe a schedule job and script include too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2018 11:29 PM
Hi Omkar and everyone,
I found a business rule which is creating empty groups. I put logs and tested it. Here is the BR and logs.
(function executeRule(current, previous /*null when async*/) {
var bs = new GlideRecord('cmdb_ci_service');
//bs.addQuery('Operational_status', 'operational');
bs.addQuery('sys_id', current.business_service);
bs.query();
if(bs.next())
{
if(bs.u_scope_region == 'global')
{
current.setValue('assignment_group', bs.support_group);//setting business service's Support group to Incident assignment Group
gs.log("Meenu - Selected Global service is: "+ bs.name + ",Assignment Group is: "+ current.assignment_group.name);
}
else if(bs.u_scope_region == 'local')
{
var userco = current.caller_id.country;
var con = "u_country="+userco;
gs.log("Meenu - usercountry"+ userco);
var co = new GlideRecord('u_ag_co_lookup');
//co.addQuery('u_Country', userco);
co.addEncodedQuery(con);//Searching for relevant groups in master table based on User's country updated in user profile
co.query();
while(co.next())
{
var query = "active=true^u_local_sd=true^u_country_support="+user+"^ORdescriptionLIKE"+co.u_country.getDisplayValue();
gs.log("Meenu - selected country: "+ userco);
var ag = new GlideRecord('sys_user_group');
ag.addEncodedQuery(query);//Searching for local SD group from resulted list of group from master table
//ag.addQuery('u_local_sd', true);
//ag.addQuery('u_country_support',co.u_country);
ag.query();
if(ag.next())
{
gs.log("SGS Project - selected group: "+ ag);
current.assignment_group = ag.sys_id;
gs.log("Meenu - Selected Local service is: " + bs.name+ ",Assignment Group is: "+ current.assignment_group.name);
}
gs.log("We found issue 1");
ag.update();
gs.log("We found issue 2");
}
}
else
{
current.assignment_group = "3d13fc04db29a7804ee710284b96192d"; //Default - Application ServiceNow
gs.log("Selected service is not scoped & Assignment Group is: "+ current.assignment_group.name);
}
//bs.update();
}
})(current, previous);
Please let me know if i am on right track.
Regards,
Geet

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2018 11:39 PM
Hi
I don't think this is the business rule because there is no ag.initialize() used which will create a new entry. or even ag.insert() anywhere. Check for scheduled jobs. Go through the link i provided.