All the fields get read only when incident closed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 09:21 PM
function onLoad() {
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-23-2024 10:28 PM
Hi @nowitsvashu ,
It looks like there is a small typo in your code. The function getEditbleFields() should be getEditableFields().
var incidentState = g_form.getValue('state');
var editableFields = g_form.getEditableFields(); // Fix typo in function name
if (incidentState == 7) {
for (var i = 0; i < editableFields.length; i++) {
g_form.setReadOnly(editableFields[i], true);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2024 11:16 PM
Hi @nowitsvashu ,
OOTB all fields will become read only when incident is closed - so why create a script for something that is already made OOTB? What is the business case?
If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
best regards
Anders
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2024 11:26 PM
Hi @nowitsvashu
I believe its already an OOB feature, you can check Incident.* Write ACL where in the condition it is mentioned
Also, Using client script or UI polciy is not the best idea for your requirement, as these only works for form layout, it will still expose the incidents to be updated from LIST layout unless you block it using list edit ACL or have an onCellEdit client script which is unnecessary effort.
Best way to secure updation is ACL.
Aman Kumar