Target date not found in work calendar

“Target date not found in work calendar” was an error that was reported to me by a customer using workflow in AX2009. It was easy to find that it was thrown by WorkflowWorkCalendarDueDateProvider.isWorkingDay() but it was far from obvious why.

I tried to update the calendar in approval time limit, although it didn’t seem to be used in that moment (but it did automatically default to a calendar for a previous year):


This seemed to be the core problem – the calendar contained dates for a single year only and anything outside that year caused an error (because, as the error message correctly said, the target date was not found in work calendar).

Changing the calendar helped a little bit, but the workflow failed with the same error a moment later. I found that the calendar ID was saved in every single workflow step (WorkflowStepTable.Duration):



It seems to me that:

  1. A calendar used in workflow should cover all possible dates (we can add additional dates to the calendar when needed, but we won’t have to ever change the reference to calendar).
  2. If it needs to be changed, the workflow configuration should be dropped and set up again.
  3. But it’s of course possible to update all workflow steps from code:
WorkflowStepTable   step;
WorkflowConfigDate  confDate;
str                 newCalendarId = 'Workflow';
while select forUpdate step
    confDate = WorkflowConfigDate::create(step.Duration);
    step.Duration = confDate.pack();


  1. How do I do the same thing in Ax 2012 ?
    Method WorkflowConfigDate::create Receives a Packed Class

    • Don’t try to use this piece of code in AX 2012. The whole Duration field has been deprecated there.

Comments are closed.