client script-set read only

yardenKrispel
Tera Contributor

 

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

 

17 REPLIES 17

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

Mohanraj_0-1700749990249.png

Mohanraj_1-1700750013126.png

 

In List View

Mohanraj_2-1700750044379.png

 

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.

ACL not work 

yardenKrispel_0-1700748028896.png

 

yardenKrispel_1-1700748053337.png

 

p_n
Tera Guru

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);
}



pradnya_nabar_0-1700822799833.png


Please mark my answer as helpful if you find solution correct.

Regards,
Pradnya