Urgent help required regarding difference in User profile while submitting the catalog form

Shivani161
Mega Contributor

Hi All,

 

There is a date validation field in the catalog form. When I am selecting the current date(there is no error message), when I impersonated the user, I still don't see the error message when we select the current date.

But when user is doing the same from his machine, current date is throwing an error. 

I checked both the profile, the time zone is same for us. 

 

 

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }


    var select_date = new Date(newValue);
    var current_date = new Date();
    current_date.setHours(0, 0, 0, 0);
    var date_communications_should_be_sent = new Date(g_form.getValue('date_communications_should_be_sent'));

    var dayOfWeek =  select_date.getDay();

    if (dayOfWeek == 0 || dayOfWeek == 6) {
        g_form.clearValue('date_communications_should_be_sent');
        g_form.showFieldMsg('date_communications_should_be_sent', 'Weekend dates are not allowed', 'error');
        return;
    }

    if (select_date < current_date) {
        g_form.clearValue('date_communications_should_be_sent');
        g_form.showFieldMsg('date_communications_should_be_sent', 'Past dates are not allowed', 'error');
        return;
    }
    var ga = new GlideAjax('BusinessDateValidation');
    ga.addParam('sysparm_name', 'reportRequestDateValidation2');
    ga.addParam('sysparm_date', newValue);
    ga.addParam('sysparm_date1', date_communications_should_be_sent);
    ga.addParam('sysparam_days', 9);
    ga.getXML(getResponse);

    function getResponse(response) {
        var answer = response.responseXML.documentElement.getAttribute("answer");

        if (answer == 'false') {
            g_form.clearValue('date_communications_should_be_sent');
            g_form.showFieldMsg('date_communications_should_be_sent', 'Date must be equal to or less than 9 business days from current date', 'error');

        }
    }
   

}
 
Shivani161_0-1716389676851.png

 

Thanks!

0 REPLIES 0