Vendor group members restricted to see tickets only assigned to them

Zubair Alam
Tera Contributor

We have a requirement:
If Vendor Group in checked (see screenshot), the members of such group should only be able to see the tickets assigned to their group only. 
What is the best way to address this requirement? ACL/Query Business Rule??
All help is greatly appreciated. Thanks. 

 

ZubairAlam_0-1735058381032.png

 

2 ACCEPTED SOLUTIONS

@Zubair Alam 

you can have it at task level but ensure it runs only for problem, change, incident

OR

create separate one on each of those tables

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

Thank you for marking my solution as helpful! The community now supports multi-solution acceptance, allowing you to accept multiple answers.

View solution in original post

14 REPLIES 14

Runjay Patel
Giga Sage

Hi @Zubair Alam ,

 

Display query business rule would be the right choice. you can do something like below.

if (gs.getUser().isMemberOf('Vendor Group')) { // Check if user is in any vendor group
    var grGroup = new GlideRecord('sys_user_group');
    grGroup.addQuery('u_vendor_group', true);
    grGroup.query();
    
    var groupIds = [];
    while (grGroup.next()) {
        groupIds.push(grGroup.getUniqueValue());
    }
    
    // Restrict query to tickets assigned to vendor's group
    if (groupIds.length > 0) {
        current.addQuery('assignment_group', 'IN', groupIds.join(','));
   
}

 

-------------------------------------------------------------------------

If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.


Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay

-------------------------------------------------------------------------

Thanks for the help @Runjay Patel . 
Can this be applied to all the child tables of task (Incident, Problem, change, Request) separately to cover all types of tickets assigned to the group in question?

Hi @Zubair Alam ,

you have to write separately for each table.

Thank you for marking my solution as helpful! The community now supports multi-solution acceptance, allowing you to accept multiple answers.

Anand Kumar P
Giga Patron
Giga Patron

Hi @Zubair Alam ,

ServiceNow suggests to use before query business rules to active this requirement. Refer below kb

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

 

If my response helped, please mark it as the accepted solution and give a thumbs up👍.
Thanks,
Anand