Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

Users can able to see their parent group or nested group tickets only

sd khaja
Tera Contributor

we have categories and their assignment groups like 

1. Hardware - (Hardware group)

2. Software - (Software group)

3. Resource - (Resource group)

4. Inquiry- (Inquiry group)

 

every parent group has nested groups of up to 20+ 

if the logged-in user is a member of the Hardware group or any of its child groups, he can only see tickets which 

'Category' = "Hardware"

 

if the logged-in user is a member of the Software group or any of its child groups, he can only see tickets which 

'Category' = Software"

1 REPLY 1

Namrata Ghorpad
Mega Sage

Hello @sd khaja ,

Create before query business rule on incident table and write the below script.

(function executeRule(current, previous /*null when async*/) {

	// Add your code here
	var arr=[];
	var grmem=new GlideRecord('sys_user_group');
	grmem.addQuery('parent','software group sys_id');
	grmem.query();
	while(grmem.next())
		{
			arr.push(grmem.getValue('name'));
		}
	if(gs.getUser().isMemberOf('software group name')) 
		{
			for(var i=0;i<arr.length;i++)
				{
					if(gs.getUser().isMemberOf(arr[i]))
						{
							current.addQuery('category','software');
						}
				}
		}

})(current, previous);

 

Please mark my answer as correct and helpful if it helps you.

Regards,

Namrata