Lock calendar day based on condition in record producer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2025 02:29 AM
Hi Everyone,
We have a requirement in our current project, that for one of the record producers, we have two variables i.e. Start date and end date.
We want those fields to be greyed out on basis of certain conditions.
For example: If A is selected from the dropdown (conditional third variable) in the above field then the Start date should have only Wednesday and Thursday selectable to user (lock other days).
Is it possible, if yes. please suggest how?
Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2025 05:27 AM
I don't know of a way to grey them out, but you can create a client script that checks the values and throws an error message if they pick an incorrect date. The client script could also set the date to the closest correct date and show a message explaining why it was changed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 04:30 AM
Hi Jenni,
if you have any example like this to lock Day, please provide the script.
Thank you!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 06:51 AM
Like I said, I don't know of anyway to grey out dates. However, here's a sample onChange client script of one I have used to make sure the date entered is 2 days in the future.
var datevarname = 'your date variable name';
var strdate = newValue.toString();
var target = new Date(strdate);
var today = new Date();
var minutes_from_now = 2 * 24 * 60 * 60 * 1000; //2 days
var future_date_time = new Date(+today + minutes_from_now);
var future_date = new Date(future_date_time.toDateString()); //must strip off time component
if (+target < +future_date) {
g_form.showFieldMsg(datevarname, "Date must be 2 days in the future.", "error");
}else{
g_form.hideFieldMsg(datevarname);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2025 06:56 AM
you cannot lock those down.
Instead you can write onChange catalog client script or UI policy to perform the validation
What's your exact requirement?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader