date variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 05:00 AM
Hi All,
I have a date variable 'xyz' which value is getting auto populated based on other 2 variable's values but still not read only. When the value of the date variable 'xyz' is not empty then I need to restrict the user to select any date which is greater than the current value of that date variable xyz that means user can select any date till the date which is already getting auto populating but not greater than that.
I want to do it using on change client script.
Can you please help me out.
Thanks in advance.
Regards,
Abhisek Chattaraj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 05:14 AM
then you will require 1 more hidden variable to store the auto populated date
Then you can use onChange client script and compare the date which user gives against this hidden date value
1) have another date variable on form towards the end and hide it using UI policy
2) then using Ajax set both the date variables
3) then create onChange client script to compare both the dates
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 07:10 AM
Thanks for your reply.
I am not allowed to create another hidden variable.
Thanks&Regards,
Abhisek Chattaraj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2025 07:30 AM
I don't think any other way other than hidden variable.
then the only way is to use onchange + GlideAjax and validate everytime and don't auto populate.
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-06-2025 11:46 PM
Thanks for your reply.
I have tried with this but the problem is when the date variable xyz is getting auto populated with the greater date then also it is throwing the error message and setting it to the old auto populate date value.
Regards,
Abhisek Chattaraj.