Empty Groups are getting created

geet
Tera Guru

Hi All,

Groups with empty name are getting created. Below is the screenshot.

find_real_file.png

Can anyone suggest why it is happening.

Regards,

Geet

 

8 REPLIES 8

Omkar Mone
Mega Sage

Hi 

Can you check for some business rule written. I think that is the problem groups are getting created.

Check the below link too. 

It maybe a schedule job and script include too.

https://community.servicenow.com/community?id=community_question&sys_id=57f50761db1cdbc01dcaf3231f96...

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);

find_real_file.png

Please let me know if i am on right track.

 

Regards,

Geet

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.