Sandeep Rajput
Tera Patron

@charitha ts You can create an onChange client script on both of your variables and use the following code.

 

 

// Get today's date
    var today = new Date();
    today.setHours(0, 0, 0, 0); // Set time to midnight for accurate comparison

    // Parse the selected date
    var selectedDate = new Date(newValue);

    // Calculate two weeks from today's date
    var twoWeeksLater = new Date(today);
    twoWeeksLater.setDate(today.getDate() + 14);

    // Check if selected date is within two weeks
    if (selectedDate >= today && selectedDate <= twoWeeksLater) {
        g_form.addInfoMessage('The selected date is within two weeks of today.');
    } else {
        g_form.clearMessages(); // Clear messages if no longer in the two-week window
    }

 

 

Update the logic to show message/display exception reason field.

 

Hope this helps.

View solution in original post