@niveditakumari  You only need to change below line of code

 

 g_form.addErrorMessage('kindly select date after ' + validatedOutput.requiredDate.toString());

 

function onSubmit() {
    //Type appropriate comment here, and begin script below

    var validateSelectedDate = new GlideAjax('global.ValidationUtils');
    validateSelectedDate.addParam('sysparm_name', 'validateDate');
    validateSelectedDate.addParam('sysparm_expectedDate', g_form.getValue('expected_date')); //Replace your date time variable
    validateSelectedDate.getXMLAnswer(function getExpectedDate(answer) {
        var validatedOutput = JSON.parse(answer);

        if (validatedOutput.correctDateSelected == 'No') {
            g_form.addErrorMessage('kindly select date after ' + validatedOutput.requiredDate.toString());
            return false;
        }
    });


}

 

If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!

Hi @SANDEEP28

 

I have made that changes. 

I'm getting still same error. 

 

function onSubmit() {
    //Type appropriate comment here, and begin script below

    var validateSelectedDate = new GlideAjax('global.ValidationUtils');
    validateSelectedDate.addParam('sysparm_name', 'validateDate');
    validateSelectedDate.addParam('sysparm_expectedDate', g_form.getValue('expected_date_time')); //Replace your date time variable
    validateSelectedDate.getXMLAnswer(function getExpectedDate(answer) {
        var validatedOutput = JSON.parse(answer);

        if (validatedOutput.correctDateSelected == 'No') {
            g_form.addErrorMessage('kindly select date after ' + validatedOutput.requiredDate.toString());
            return false;
        }
    });
 

niveditakumari_0-1742828634991.png  

 

Can you please help me to correct that. 

 

Regards, 

NIvedita 

 

 

 

Hello @niveditakumari 

 

Did you try my script ? 

 

Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket. 

 

Regards,

 

Shivalika 

 

My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194

 

My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

Hi @SANDEEP28

 

I'm still getting same error. 

 

Regards, 

Nivedita 

 

 

@niveditakumari Share screenshot of error and scripts