How can i make incident fields read only if state is closed in Agent Workspace?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 02:30 AM
function onLoad() {
//Type appropriate comment here, and begin script below
var fields = g_form.getEditableFields();
alert(fields);
if(g_form.getValue("state",'closed')) {
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
} } }
USED THIS SCRIPT | BUT NOT WORKING
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 03:42 AM
There might be table.* And table.field_name ACLs present before. So do adjust the ACLs if present with role and the state condition
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 03:43 AM
@kalakaramad_20 do you wamt it just for agent workspace or all views. If you want for all views ACL will work fine as suggested by @jaheerhattiwale . Share screenshot of your ACL if possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 04:32 AM
Done in client script but its not working.
state is closed But the Fields are editable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 04:35 AM
@kalakaramad_20 if you want to try with client script then update the script as below
var fields = g_form.getEditableFields();
alert(fields);
if(g_form.getValue("state") == 'closed') {
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
} } }
Please check if closed state value is closed or anything else
Please mark as correct answer based on impact
ServiceNow Community Rising Star, Class of 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 05:31 AM
No Impact Sir