If state get changes to Closed then all fields make read only in change table

Sirisha Snow
Tera Contributor

Request to provide client script to fulfill the above story in change table. Thanks

1 ACCEPTED SOLUTION

Pratiksha2
Mega Sage

Hello @Sirisha Snow -

I noticed that you marked my answer as helpful.
So if resolves your query then please Accept my solution ‌‌✔️ as well and close the thread to help future readers to understand.

Thank You!

View solution in original post

7 REPLIES 7

Sandeep Rajput
Tera Patron
Tera Patron

@Sirisha Snow You can achieve this either by creating a UI Policy or write ACL on your change table.

 

In case of UI Policy, simply check the state in condition builder. For ACL you can create a table and field level ACLs and check the state of the current record. if the state is closed then you can return false in the ACL script.

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Sirisha Snow 

 

You can try the UI policy or If i am not wrong it is OOTB. 

 

https://www.servicenow.com/community/developer-forum/when-incident-is-closed-what-makes-all-the-fiel...

 

On load client script

change the state value as per state.

 

if(g_form.getValue('state') == '3') //check closed complete backend value once
{
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
    g_form.setReadOnly(fields[x], true);
}
}

 

*************************************************************************************************************
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]

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

Pratiksha2
Mega Sage

Hello @Sirisha Snow - 
Please try below On-change client script on change request table if state changes:

  if(newValue=='3'){
	var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
    g_form.setReadOnly(fields[x], true);
}
  }

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,

Pratiksha

Rohini S Sane
Tera Guru

Hello @Sirisha Snow ,

You can use UI policy to make fields read only. Give condition state is closed.

 

Regards,

Rohini Sane