calculating business days

sonita
Giga Guru

How to calculate business days on a catalog form?

1 ACCEPTED SOLUTION

Soni,



  Add alert in your call back function as shown below and let me know what you see.


    Here is your onChange client script on Needed By   variable:


function onChange(control, oldValue, newValue, isLoading) {


  if (isLoading || newValue == '') {


  g_form.setDisplay('title', false); // put in the variable name you want to show or hide according needed by date


  return;


  }


  var ga = new GlideAjax('ValidateNeededBy');


  ga.addParam('sysparm_name','validateDate');


  ga.addParam('sysparm_needed_by',newValue);


  ga.getXML(callBack);



  function callBack(response) {


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


alert(answer);


  if(parseInt(answer)>=27){


  g_form.setDisplay('title', false); // put in the variable name you want to show or hide according needed by date


  }


  else{


  g_form.setDisplay('title', true); // put in the variable name you want to show or hide according needed by date



  }


  }


}


View solution in original post

23 REPLIES 23

Actually the name of my variable was not correct. Thanks again for all your help!!!


Soni,



Glad, you got this resolved.


Note: the value 27 is considering 8-5 schedule (9 hours each day 9*3). If you use 24 hour schedule, make sure you update this value according to your schedule.(so instead of 27 it would be 24*3=72)



Thanks,


Abhinay


yeah that's correct! thx


Hello Abhinav ,




Could you please help me with similar issue ,


Where I need to have a SLA attached if the Incident is created within 5th - 15th working day of each month.



Any lead on this would be of a great help!



Thanks in advance!!