How to make fields readonly using client script based on choice value as No
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-09-2023 02:14 AM
I want to make calender Date time field readonly based on a condition where a field with choices yes and No is selected as yes using client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-09-2023 02:17 AM - edited ā08-09-2023 02:18 AM
For this you can create a UI policy with the condition as
When Field value is 'no'.
and from the related list UI policy action you can create a new action to make date_field read only.
I Hope this helps !
āļø Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-09-2023 02:17 AM - edited ā08-09-2023 02:19 AM
Hello @kavitha N ,
you can configure an on change client script on the yes or no field and can write a script as below
if(newValue=="Yes"||newValue=="yes")
{
g_form.setReadOnly('your_date_time_field_backend_name' , true);
}
OR
Create a UI policy with condition as yes or no field is Yes
and in the UI policy actions create a new action where your date time field can be set to read only
Hope this helps
Mark my answer correct if this helps you
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-09-2023 02:17 AM
Hi you can create a OnChange client script on yes/no variable
Script:
Harish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā08-09-2023 03:11 AM
Hi @kavitha N ,
Why use client scripts when an UI policy without scripting can solve your query?
if my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
best regards
Anders
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/