Client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2025 03:07 AM
Set all the fields Read Only based on selection of particular choice in a field (state = cancelled)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2025 08:48 AM
You can use an onChange Client script or UI Policy. Then use the code below:
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-23-2025 08:50 AM
function onLoad() {
var stateValue = g_form.getValue('state');
// Ensure this matches the actual value of the "Cancelled" choice in your state field
if (stateValue === 'cancelled') {
var fields = g_form.getEditableFields();
for (var i = 0; i < fields.length; i++) {
g_form.setReadOnly(fields[i], true);
}
// Optional: keep the 'state' field editable to allow reverting
// g_form.setReadOnly('state', false);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-23-2025 02:18 PM
Is this for the Incident Table? If so there should already be an OOTB UI Policy for this named Make fields read-only on close (at least there was in my PDI).
If this is for another table, you could always copy that UI policy and apply it to a different table (Though creating each UI Policy action could get tedious).
Otherwise folusho's suggestion will be the quickest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2025 07:26 PM
Hi @Maidhili_G try below code i have test it on pdi and also you can make by ui policy
if my answer helps you mark helpful and accept solution