Restrict problem task closure rights to the members of Specific assignment group

snehasaha
Tera Contributor

I am new to ServiceNow development. We have a requirement to restrict problem task closure rights to the members of Specific assignment group. The new assignment group say "ABC" is already created. Can someone please help on how can I proceed further? If any ACL needs to be created for this and what should be steps ? 

9 REPLIES 9

@snehasaha 

share your script please along with BR configuration

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

@Ankur Bawiskar PFA the BR and script for your reference

@snehasaha 

you didn't copy the script as it is and you should pass group name directly

// give the group name here
    if (!gs.getUser().isMemberOf('Problem Task Owner Group')) {
        gs.addErrorMessage('You do not have permission to close this task');
        current.setAbortAction(true);
    }

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

@snehasaha 

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

Runjay Patel
Giga Sage

Hi @snehasaha ,

Create before insert/update br on problem task table and use below script.

if (!gs.hasRole('admin')) { // Allow admin to close if needed
    var groupCheck = false;
    var assignedGroup = current.assignment_group.getDisplayValue(); 

    if (assignedGroup == 'ABC') {
        groupCheck = true;
    }

    if (!groupCheck) {
        gs.addErrorMessage("Only members of the 'ABC' assignment group can close this Problem Task.");
        current.setAbortAction(true);
    }
}

 

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

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

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