How to make a field readonly when certain field value changes from the oldvalue ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2025 12:52 AM
Need to make a field readonly when the value changes for the first time to avoid multiple changes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2025 01:44 AM
Hi @ABHI08 ,
Create a onchange client script on that particular field.
if (oldValue && oldValue !== newValue) {
g_form.setReadOnly('your_field_name', true);
Above script ensures that once a field’s value differs from its stored oldValue, it will make field read only immediately.
Try this once and let me know. If you find this helpful, please accept this as a solution and hit the helpful button..
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-06-2025 01:47 AM - edited ‎08-06-2025 01:48 AM
It is making the field read only for the time being when the field value is changed but after saving the form it again becomes editable. I want the field to be editable after the change occured for the first time
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-05-2025 04:28 AM
Hi @ABHI08 ,
Can you try to describe your requirement a little deeper than what you have done? What is the business case that you have?
If my answer has helped with your question, please mark my answer as the accepted solution and give a thumbs up.
Best regards
Anders
Rising star 2024
MVP 2025
linkedIn: https://www.linkedin.com/in/andersskovbjerg/