How to fix ACL issue on Assigned to
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi All,
as per my system setup Group and assigned to fields non-mandatory. No dependency between 'Assigned to' and Assignment group' designed it like that. if I select value in assigned to field automatically assignment group will become empty. ( WE are good here, no issue).
Use case : INC assigned to ITIL Group , as a ITIL user after I reassign INC to non-itil user 'assigned to' field should be read-only ti all ITILgroup members..
To control AssignedTo field I have designed below ACL.
PROBLEM : Below ACL code causing the problem. currently INC has been assigned to ITIL group , as a ITIL user when I tried to reassign to non-ITIL/Non admin user system not accepting new value in AssignedTo, not saving new value in Assigned to Field. always staying with group value. How to fix it. ?
ACL :
Write , Admins Override
Advanced=true
script :
var assignee = false;
var gr = new GlideRecord('sys_user_grmember');
gr.addEncodedQuery('group.name='ITIL User');
gr.addquery('user', current.assigned_to);
if(gr.getRowCount()>0){
assignee=true;
}
if(gs.hasRole('admin') || gs.hasRole('sn_hr_core.admin')){
answer=true;
}else if(assignee || gs.getUser().isMemberOf(current.assignment_group.name.toString()){
if( gs.hasRole('itil) ){
answer=true;
}
}
else{
answer=false;
}
if I adjust else If condition like below new value getting accepted in AssigndTo field
if(assignee || gs.getUser().isMemberOf(current.assignment_group.name.toString() || gs.hasRole('itil)){
answer=true;
}
but after record updating, 'Assigned To' field is becoming editable to ITIL users. we don't want that. after updating INC with non-iti user field should be readonly for itil users.
Please let me know how can I fix this ACL code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
did you add gs.info() and see ?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Ankur Bawiskar , can you please look into my inputs, if do you like to share some insights please share.