- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 11:35 PM
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
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-06-2022 11:41 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2022 12:20 AM
Any reason to use client side script?
1) Approach 1:
you can run onChange client script on State Field change and use GlideAjax and verify if the logged in user is member of that group
OR
2) Approach 2:
Display business rule:
g_scratchpad.isMember = gs.getUser().isMemberOf(current.assignment_group+'');
onSubmit Client Script
function onSubmit(){
var isMember = g_scratchpad.isMember.toString();
if(g_form.getValue('assigned_to') == g_user.userID || isMember == 'true'){
// allow
return true;
}
else{
// not allowed
alert('Not allowed to close');
return false;
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader