Показать сообщение отдельно
Старый 30.01.2014, 16:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,493 / 847 (79) +++++++
Регистрация: 28.10.2006
goshoom: Target date not found in work calendar
Источник: http://dev.goshoom.net/en/2014/01/ta...ate-not-found/
==============

“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';;ttsbegin; while select forUpdate step{ confDate = WorkflowConfigDate::create(step.Duration); confDate.parmDailyCalendar(newCalendarId); confDate.parmHourCalendar(newCalendarId); step.Duration = confDate.pack(); step.update();} ttscommit;


Источник: http://dev.goshoom.net/en/2014/01/ta...ate-not-found/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.