Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Priyanka_786
Tera Guru
Tera Guru

Use case:-  To make particular field read-only once the the form is saved only based on some field conditions. (Not on load) Please note that on list view is not considered as it's already read-only.

 

Analysis:-  

1. As there is no role specific condition, so ACL approach can't be used.

2. As per the use-case, it should not be made read-only on the form load hence UI Policy can't be used.

3. Considering above these points, let's try using Client script.

 

Solution:-

1.  Write onLoad Client script on given table  and use below script. 

if (!g_form.isNewRecord())
 { 
// Check if its not a new record, record is saved

// Add the condition as per your need

 g_form.setReadOnly("field_name", true);

}
     
 

Conclusion:- This requirement can be achieved using g_form API isNewRecord() function from onLoad Client script. 

 

Comments
MuktaRey
Mega Contributor

/no role specific condition, so ACL approach can't be used.???

Version history
Last update:
‎11-27-2024 03:13 AM
Updated by:
Contributors