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

No, I can't through dicanory, only through ui polocy or client script

Any reason not to take Dictionary way? 

 

UI Policy:

 

Write a UI Policy

Active = True or False

UI Action

State = Read Only

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

I did ui policy but it only works for me inside the form itself and not in the list I am attaching a picture where it doesn't work for me 

yardenKrispel_1-1700746925009.png

 

Hi @yardenKrispel,

 

To disable the edit option in List view has two ways.

1. ACL 

operation : write

   incident.state

   In script

answer = false;

 

2. On Cell edit Client script 

function onCellEdit(sysIDs, table, oldValues, newValue, callback){
var saveAndClose = true;

if(newValue != oldValue){
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.

now its not work : 

yardenKrispel_0-1700747710430.png