client script-set read only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 05:15 AM
Hi, I need to make a client script that will make the state button read only even on the fly. A new incident that I open will directly be read only and also when there is an incident form in the system and I want to change the status, so I can't. please me give client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 06:35 AM - edited 11-23-2023 06:37 AM
Hi @yardenKrispel,
To make state field Read only in form Level, you can to use Dictionary entries or UI Policy or On Load client script
To make state field Read only in List view, you can either use ACL or On Cell Edit Client script
ACL
In List View
In On cell edit Client Script
function onCellEdit(sysIDs, table, oldValues, newValue, callback){
var saveAndClose = true;
if(newValue != oldValue){
alert('you cant change the state field');
saveAndClose = false;
}
callback(saveAndClose);
}
If my response helps you to resolve the issue close the question by Accepting solution and hit thumb icon. From Correct answers others will get benefited in future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 06:00 AM
ACL not work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-24-2023 02:51 AM
Hi @yardenKrispel You can try "onCellEdit" Client script to prevent users from changing state in list view and to make state read only on the form you can create a UI Policy.
function onCellEdit(sysIDs, table, oldValues, newValue, callback) {
var saveAndClose = true;
if (newValue) {
saveAndClose = false;
alert("You are not allowed to change the state field");
}
callback(saveAndClose);
}
Please mark my answer as helpful if you find solution correct.
Regards,
Pradnya