Make all fields readonly when state s changed to closed including work notes

Priyanka_77
Tera Contributor

I want to make all the fields read only including work notes on hr case form when state is change to closed.

5 REPLIES 5

Mark Manders
Tera Patron

Put a deny-unless write ACL on the table with active = true as condition. Deny-Unless ACLs are evaluated first. If the case isn't active, nobody can write to any field on the table.

Ankur Bawiskar
Tera Patron

@Priyanka_77 

please use approach mentioned by @Mark Manders 

Do let us know if any further help required

Tanushree Maiti
Tera Patron

Hi @Priyanka_77 

 

To make all fields—including work notes and additional comments—read-only on the HR Case form when the state changes to Closed, use a combination of an ACL and a UI Policy or try with only ACL

 

1. To ensure that users cannot bypass these UI scripts (such as via list editing or REST APIs), create a Write ACL
Navigate to System Security > Access Control (ACL) and click New.
• Type: record
• Operation: write
• Name: HR Case [sn_hr_core_case] and select None (for table-level) or * (wildcard) to lock all fields.
• Requires role: Select roles authorized to edit active cases
• Condition: Add State is not one of Closed Complete, Closed Incomplete, Closed Rejected, Canceled (adjust according to your HR configuration).

 

2. Create a UI Policy
Use a UI Policy to prevent edits upon form load
• Table: HR Case (sn_hr_core_case)
• Conditions: State is Closed //update condition as per your requirement
• UI Policy Actions:
o Select Leave unchecked for Reverse if false.
o Add the Work notes and Comments (Additional Comments) fields with other field as per your requirement and set their Read-only status to True.

 

Tejas Adhalrao
Mega Sage

Hi @Priyanka_77  ,]

A common approach is to use a UI Policy or Client Script with the condition State = Closed and set all fields to read-only.However, Work Notes are a journal field and don't always respect standard UI Policies.  so as Mark Manders  mentioned create Deny unless ACL to validate conditions write script  

For example:

answer = current.state != 'closed';

 

If you found my solution helpful, please mark it as Helpful and Accept Solution.