- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2019 03:01 AM
Is it possible to make a field mandatory and read only in the form ? If yes what is the use ?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2019 02:09 PM
Hi Karunakar,
You can of course set a field to both Read-Only and Mandatory, however the Read-Only part will "win-out" against it. Meaning, even if there isn't a value in the field, you could still save the record. Just like Mandatory will win out over Visible.
I would rarely recommend using the checkboxes on the Dictionary Entry to set Read-Only and Mandatory, instead I'd recommend using a UI Policy.
I think there are very few use cases for making something Read-Only and Mandatory. One I can think of is if you want to ensure a field is always Mandatory, and there are cases that would change whether or not it is Read Only, but even then, I would think you could have the Mandatory set to true/false with the opposite of the same condition as the Read Only being set to true/false.
Is there a specific use-case you had in mind, or did you just want some thoughts on this? Let me know if I can assist further.
If my answer was helpful or answered your question, please mark it as 'Helpful' or 'Correct'
Thanks!
Josh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2020 08:50 AM
That works!! I had used the 'else' but my braces were set differently.
Thank you!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2020 08:58 AM
That works!
Another angle I was presented with was by default, users all having role 'test_read_only', and instead of the role being removed, adding the role 'test_mandatory' for specific users.
Would that even be possible?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-30-2020 07:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-14-2024 10:28 PM
Hi Josh, I had a interview question. Can u solve it for me?.
I can make a field as Mandatory, read-only and visible using Dictionary Override and as well as UI Policy. Which one would u chose?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-15-2019 11:09 PM
Hello Karunakar,
Client Script:
Client scripts allow the system to run JavaScript on the client (web browser) when client-based events occur, such as when a form loads, after form submission, or when a field changes value.
Use client scripts to configure forms, form fields, and field values while the user is using the form. Client scripts can:- make fields hidden or visible
- make fields read only or writable
- make fields optional or mandatory based on the user's role
- set the value in one field based on the value in other fields
- modify the options in a choice list based on a user's role
- display messages based on a value in a field
UI POLICIES:
UI policies dynamically change the behavior of information on a form and control custom process flows for tasks.
For example, you can use UI policies to make the number field on a form read-only, make the short description field mandatory, and hide other fields. Basic UI policies do not require any scripting, however for more advanced actions, use the Run scriptsoption.
You can also use client scripts to perform all of these actions, but for faster load times use UI policies when possible
Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade
Abhishek Gardade