Catalog Client Script - Exclude Weekends

Syn C
Kilo Contributor

Hi, I am currently trying to build a catalog client script but I am having trouble.

We have a request that if on the date field if a user selects a date that is within 2 business days from the current date then a new field with display.  The problem is in using the UI Policy we cannot exclude weekends.  So I knew that I could do it using a catalog client script but I am having trouble call the script include so that I can reference the setSchedule.

Any help would be appreciated.

 

10 REPLIES 10

Good catch with the sysparm_add parameter in the Client Script. (That's what I get for copy/paste).

My guess is that you are using some variable to pick and that variable is start_date. If that is incorrect, you can change that in the configuration portion of the Catalog Client Script. Whatever you pick is newValue, not the variable name. This may be why it is not working.

You also may want to set the variable as hidden to start before the evaluation, or change the visiblity if false to be false.

function showVar(response){
    var answer = response.responseXML.documentElement.getAttribute("answer");
    if (answer == 'true') {
        g_form.setVisible('bus_days', true);
    } else  {
        g_form.setVisible('bus_days', false);
    }
}

or

function showVar(response){
    g_form.setVisible('bus_days', false); //set to false
    var answer = response.responseXML.documentElement.getAttribute("answer");
    if (answer == 'true') {
        g_form.setVisible('bus_days', true);
    }
}