Managing time and holiday schedules

You can manage time and holiday schedules by using the JavaScript API. You can set time and holiday schedules for activities on the Implementation tab. After you add a new time or holiday schedule, it immediately becomes available in the time or holiday schedule list in the authoring environment.

About this task

Avoid removing the default holiday or time schedules. The default schedules are specified in the 99Local.xml configuration file. Changes to the default schedules require changes to the 99Local.xml file.

Procedure

  1. Create an integration service by using a server script similar to the following script:
    var holidaySchedule = new tw.object.TWHolidaySchedule();
              holidaySchedule.name = "holidaySchedule" + new Date().getTime();
              holidaySchedule.dates = new tw.object.arrayOf.Date();
              holidaySchedule.dates[0] = new tw.object.Date();
              holidaySchedule.dates[0].parse("20100101", "yyyyMMdd");
              holidaySchedule.dates[1] = new tw.object.Date();
              holidaySchedule.dates[1].parse("20100223", "yyyyMMdd");
              holidaySchedule.dates[2] = new tw.object.Date();
              holidaySchedule.dates[2].parse("20100308", "yyyyMMdd");
              holidaySchedule.dates[3] = new tw.object.Date();
              holidaySchedule.dates[3].parse("20100501", "yyyyMMdd");
              holidaySchedule.dates[4] = new tw.object.Date();
              holidaySchedule.dates[4].parse("20100824", "yyyyMMdd");
              holidaySchedule.dates[5] = new tw.object.Date();
              holidaySchedule.dates[5].parse("20091231", "yyyyMMdd");
    		  tw.system.addHolidaySchedule(holidaySchedule). 
  2. Save and run the integration service.
    Note: It might take some time for the new holiday schedule to be available in Process Designer after running the integration service. To make use of your new holiday schedule right away, restart Process Designer before you begin modeling.
  3. Create a business process definition (BPD), and add an activity with a default service.
  4. Link the activity in a start-end flow.
  5. On the Implementation tab of the activity, select the holiday schedule that you created, and then set the time schedule to 7AM-7PM Every Day.
  6. Save the BPD.
  7. Run the BPD, and then open the Process Inspector tab to verify the due date calculation.