- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2022 01:01 AM
When the state changes to cancelled - for all the itil users -- all the fields should be readonly.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2022 01:12 AM
Hi Bharat,
Try below code in Onchange Client script on state
if(g_user.hasRole("itil") && g_form.getValue("state")==8) {
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2022 01:12 AM
Hi Bharat,
Try below code in Onchange Client script on state
if(g_user.hasRole("itil") && g_form.getValue("state")==8) {
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2022 01:20 AM
Ideal option will be to create ACL of type write for each field when state changes to Cancelled for required table & for required ITIL users.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2022 01:45 AM
Hi Bharath,
There is an OOTB UI Policy "Make fields read-only on close" which does that. You can go ahead and check that UI Policy.
When a state changes to cancelled or closed all the fields will automatically be read-only.
Thanks,
Visakha