- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 10:03 PM - edited 02-21-2023 04:08 AM
The following is the Script I wrote for the above problem It doesn't seem to work. I want feed back.
function onLoad(){
// condition to check roles of user
// other than users with roles ITIL
if( ! (g_user.hasRoleExactly("itil") || g_user.hasRoleExactly('admin') ) ){
// setting to readonly
g_form.setReadOnly('assignment_group',true);
g_form.setReadOnly('assigned_to',true);
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 11:43 PM
why not use field level WRITE ACLs on those individual fields?
update script as this
function onLoad(){
// condition to check roles of user
// other than users with roles ITIL
if(!g_user.hasRoleExactly("itil") && !g_user.hasRoleExactly('admin')){
// setting to readonly
g_form.setReadOnly('assignment_group',true);
g_form.setReadOnly('assigned_to',true);
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2023 02:21 AM - edited 02-21-2023 02:24 AM
Try this field level ACL with script. It should work

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 10:24 PM
Hi @SBohare ,
You can use this solution : https://www.servicenow.com/community/itsm-forum/make-assignment-group-and-assigned-to-fields-editabl...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 10:42 PM - edited 02-20-2023 10:44 PM
I went through the above query, and the answers there are neither complete nor working for me even after changing some parameters and adding more Scripts.Can you please look into the attachment and tell me if something looks fishy in there.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 10:58 PM
Hi @SBohare ,
You need to use the ACL for this.
Try to create write ACL for each field, so it will restrict editing from anywhere.
Anand
ServiceNow Developer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2023 11:43 PM
why not use field level WRITE ACLs on those individual fields?
update script as this
function onLoad(){
// condition to check roles of user
// other than users with roles ITIL
if(!g_user.hasRoleExactly("itil") && !g_user.hasRoleExactly('admin')){
// setting to readonly
g_form.setReadOnly('assignment_group',true);
g_form.setReadOnly('assigned_to',true);
}
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader