Restrict incident tickets based on the group

Mannam Praveen
Tera Expert

Hello, 

 

we have created the three groups like Blue green and yellow and my requirement is green group can able to see  both yellow group and blue group tickets. 

2. Blue group should not see green group tickets but they can see yellow group tickets

3. Yellow Groupcan see both blue group and green group ticket 

How to acheive this..?

 

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Mannam Praveen  

 

By any chance, you are in domain separated instance? If no, then use ACL or BR to make these restrictions. 

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

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

Ankur Bawiskar
Tera Patron
Tera Patron

@Mannam Praveen  

you can use query business rule on your table and handle this

what script did you start with and where are you stuck?

Something like this but please enhance it further

(function executeRule(current, previous /*null when async*/) {
    // Get the current user's groups
    var userGroups = gs.getUser().getMyGroups();
    var groupNames = [];
    while (userGroups.next()) {
        groupNames.push(userGroups.name.toString());
    }

    // Define the group visibility rules and give the sysIds of those 3 groups
    var greenGroup = 'Green Group SysId';
    var blueGroup = 'Blue Group SysId';
    var yellowGroup = 'Yellow Group SysId';

    // Build the query based on the user's group membership
    var query = '';
    if (groupNames.includes(greenGroup)) {
        query = 'assignment_group.nameIN' + blueGroup + ',' + yellowGroup + ',' + greenGroup;
    } else if (groupNames.includes(blueGroup)) {
        query = 'assignment_group.nameIN' + blueGroup + ',' + yellowGroup;
    } else if (groupNames.includes(yellowGroup)) {
        query = 'assignment_group.nameIN' + blueGroup + ',' + greenGroup + ',' + yellowGroup;
    } else {
        query = 'assignment_group.nameIN' + blueGroup + ',' + yellowGroup; // Default to blue and yellow if no specific group
    }

    // Apply the query
    current.addEncodedQuery(query);
})(current, previous);

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

@Mannam Praveen  

Hope you are doing good.

Did my reply answer your question?

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