Change request Cannot Request Approval if Planned Start has passed

praveenkumarr
Tera Expert

When submitted a Change Request, the user cannot click Request Approval if the Planned Start date is prior to the current date.

5 REPLIES 5

praveenkumarr
Tera Expert

Hi All, 

Thank you for helping me.

I got solution, I have written "Onsubmit" client script, it is working as expected.

 

function onSubmit() {

    //Type appropriate comment here, and begin script below
    var plannedStartDate = g_form.getValue('start_date');
    var currentDate = new Date();
    // Convert plannedStartDate to a Date object
    var plannedStart = new Date(plannedStartDate);
    // Set the time of currentDate to midnight to ignore time part in comparison
    currentDate.setHours(0, 0, 0, 0);
    // Compare the dates
    if (plannedStart < currentDate) { //STRY0010159 - Author - Praveen Rapuru
        g_form.addErrorMessage("The Planned Start date cannot be in the past. Please select a future date or today\'s date.");
        return false; // Prevent submission
    }

    return true; // Allow submission if date is valid
}