Ticket should not be closed by anyone other than assigned to/assigned group.

Mini7
Kilo Contributor

Apart from Assigned to and Group member, tickets should not be closed by anyone.

Requirements:

When tickets moved from one group to another.Restrict Previous group&group members to close ticket and make current group&group members only able to close/resolve tickets.

SCRIPTING:CLIENT SCRIPT

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

how are tickets getting closed? is it via some Close UI Action

you can update the UI action visibility for your requirement

Your earlier Conditions && current.assigned_to == gs.getUserID() || gs.getUser().isMemberOf(current.assignment_group+'')

If no UI action then you can validate this using before update business rule on that table

Script:

if(current.assigned_to == gs.getUserID() || gs.getUser().isMemberOf(current.assignment_group+'')){
	// allow
}
else{
	// not allowed
	gs.addErrorMessage('Not allowed to close');
	current.setAbortAction(true);
}

Regards
Ankur

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

View solution in original post

5 REPLIES 5

palanikumar
Giga Sage

You can create a Before Business rule and check whether the user is member of the assignment group. If not call throw error message and call current.setAbortAction(true); to cancel the updation

Thank you,
Palani

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

how are tickets getting closed? is it via some Close UI Action

you can update the UI action visibility for your requirement

Your earlier Conditions && current.assigned_to == gs.getUserID() || gs.getUser().isMemberOf(current.assignment_group+'')

If no UI action then you can validate this using before update business rule on that table

Script:

if(current.assigned_to == gs.getUserID() || gs.getUser().isMemberOf(current.assignment_group+'')){
	// allow
}
else{
	// not allowed
	gs.addErrorMessage('Not allowed to close');
	current.setAbortAction(true);
}

Regards
Ankur

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

@Mini 

Thank you for marking my response as helpful.

If my response helped you please mark it correct to close the question so that it benefits future readers as well.

Regards
Ankur

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

Hi Ankur i need client script this is server side cripting