Regarding onchange planned start date Validation in change Request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2025 07:31 AM
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || !newValue) {
return;
}var changeType = gForm.getValue('type');
if (changeType.toLowerCase() === 'normal') {
var ga = new GlideAjax('ValidateStartDateUtils');
ga.addParam('sysparm_name', 'isFutureDateTime');
ga.addParam('sysparm_selected_date', newValue);
ga.getXMLAnswer(function(response) {
if (response === 'false') {
gForm.showFieldMsg('start_date', 'Start date must be in the future for Normal changes.', 'error');
gForm.setValue('start_date', '');
}
});
}
}this is client script
var ValidateStartDateUtils = Class.create();
ValidateStartDateUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isFutureDateTime: function() {
var selectedDate = this.getParameter('sysparm_selected_date');
if (!selectedDate) return false;
var selected = new GlideDateTime(selectedDate);
var now = new GlideDateTime();
return selected.after(now) ? 'true' : 'false';
}
});and script includes but it is not working
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2025 05:19 AM
Hope you are doing good.
Did my reply answer your question?
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
05-20-2025 02:45 AM
@LokeshwarRV 'Hi , Please create UI policy and give condition like planned start date 'after' today. and select rever if false, and in UI policy action select clear value and in message write "Start date must be in the future for Normal changes.'"
Please mark correct/helpful if this helps you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 03:41 AM
Hello Sunil,
As per you told i have just created UI policy and action like below . please check it is there any mistake. if there please correct it otherwise let me know
Regards,
D Manohar Reddy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 03:58 AM
give condition like below and dont create UI policy action if you are using script, also before message give g_form.clareValue('yourfieldname');
Please mark correct/helpful if this helps you!