How can i make incident fields read only if state is closed in Agent Workspace?

kalakaramad_20
Tera Contributor

function onLoad() {

//Type appropriate comment here, and begin script below

var fields = g_form.getEditableFields();
alert(fields);
if(g_form.getValue("state",'closed')) {

for (var x = 0; x < fields.length; x++) {

g_form.setReadOnly(fields[x], true);
} } }

 

 

 

USED THIS SCRIPT | BUT NOT WORKING

19 REPLIES 19

@kalakaramad_20 Please try with ACLs.

 

Create a incident.None write acl as below

jaheerhattiwale_0-1671515048186.png

 

Create a incident.* write acl as below

jaheerhattiwale_1-1671515105093.png

 

And in all other incident.None or incident.* write acls add condition state != closed

jaheerhattiwale_2-1671515180772.png

 

Please mark as correct answer if this solves your issue.

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

Hey I did it with the help of Ui policy. 

Thanks For your Support.

@kalakaramad_20 Ok cool👍

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023

Yes With the help of ui policy it was possible for me.

@kalakaramad_20 you can mark the relevant answer correct to close the thread.


Raghav
MVP 2023
LinkedIn