How to modify a validation?

bigbacon
Giga Guru

We have a script attached to a form field which is

 

 

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

    var cdt = g_form.getValue("u_target_start_date");
    var ajax = new GlideAjax('sn_hr_core.ClientDateTimeUtils');
    ajax.addParam('sysparm_name', 'validateDate');
    ajax.addParam('sysparm_date', cdt);
    ajax.getXML(getDate);

    function getDate(response) {
        var answer = response.responseXML.documentElement.getAttribute('answer');
        //console.log(answer);

        if (answer == "false") {
            alert("Please select a Monday that is at least 2 weeks from the date of your request");
            g_form.clearValue("u_target_start_date");
            g_form.clearValue("u_year_1_effective_date");
            g_form.clearValue("u_year_1_effective_date_end");
            g_form.clearValue("u_year_2_effective_date");
            g_form.clearValue("u_year_2_effective_date_end");
            g_form.clearValue("u_year_3_effective_date");
            g_form.clearValue("u_year_3_effective_date_end");
            return false;
        }
    }
}

 

thiss was done by a third party and I am trying to figure out how to modify the underlying validation that takes place as we need to change it from 2 weeks to 3 weeks. 

 

Where in the world do you go to change something like this? Anything I can think of leads me no where.

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@bigbacon The main logic for this validation lies within the Script include 

ClientDateTimeUtils

You will be able to find this script include inside Human Resource: Core application scope.

 

Screenshot 2024-08-27 at 3.03.00 PM.png

 

Once you are inside the script include, you need to search for a function with name 

validateDate

 

Inside this function you will find the validation for two weeks.

 

Please mark the response helpful and accepted solution if it manages to answer your question.

View solution in original post

4 REPLIES 4

Sandeep Rajput
Tera Patron
Tera Patron

@bigbacon The main logic for this validation lies within the Script include 

ClientDateTimeUtils

You will be able to find this script include inside Human Resource: Core application scope.

 

Screenshot 2024-08-27 at 3.03.00 PM.png

 

Once you are inside the script include, you need to search for a function with name 

validateDate

 

Inside this function you will find the validation for two weeks.

 

Please mark the response helpful and accepted solution if it manages to answer your question.

I exported all these and searched the script for that and came up with nothing that does a validation based on a 2 week range from today's date.

 

 

Ok, update, that worked. I totally missed it all at first. 

 

Thank you

@bigbacon Glad to know it worked.