JavaScript For date Comparison with Error Message MSCRM
function ValidateDate(executionContext) {
//debugger;
var formContext = executionContext.getFormContext();
if (formContext !== null) {
var today = new Date();
var Startdate = formContext.getAttribute('new_dateandtime').getValue(); //Date Schema Name
if (Startdate > today) {
alert("Date should not be past date");
formContext.getAttribute('new_dateandtime').setValue(null);
}
else {
formContext.getAttribute('new_dateandtime').setValue(Startdate);
No comments:
Post a Comment