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 02:50 AM - edited 12-19-2022 03:00 AM
Create UI policy instead, with condition "state is closed" and view and workspace( if required for obly agent workspace view).
I think g_form.getEditableFields(); is causing issue in workspace view.
When you uncheck "Global", you get an option to add view, you cam select workspace there to make your UI policy run on agent workspace only:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 03:44 AM
Hello Done This But the Ui Policy Action What to do over there, I need to make all fields read only when state gets closed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2022 02:54 AM
@kalakaramad_20 You can create a write ACL on incident table and add the condition state is closed.
Please mark as correct answer if this solves your issue.
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:38 AM
Created An ACL but Still not working for the same.