- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-27-2020 09:21 AM
Hi all,
We have a requirement to make all fields read only on incident except State and Worknotes.
This should happen when user from the current assignment group opens the form.
if Assigned user is the current logged in user, then need to make state and worknotes only editable on the form. Remaining fields like contact type, email, category and sub category, ci, service needs to be read only.
Please help me with the client script to acheive this.
Thank you,
Balaram.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2020 04:29 AM
You can use client script for this
function onLoad(){
if(g_user.userID == g_form.getValue('assigned_to')){
// make all fields readonly
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}
// make state and work notes editable
g_form.setReadOnly('state', false);
g_form.setReadOnly('work_notes', false);
}
}
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
03-22-2022 06:50 AM
Hope you are doing good.
Did my reply answer your question?
Would you mind closing the thread by marking appropriate response as correct so that it benefits future readers.
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-02-2021 06:53 PM
Regards,
Sachin