Friday, 27 December 2013

Error: Target date not found in work calendar error and solution

To resolve this error follow the following steps
Step-I: Go to Basic àCalendar
Do the setup for calendar
Map this Calendar in Workflow configurations as show in below figure
Project àSetup àWorkflow configurations

Note: With Step-I only I had done for my first workflow scenarios. I had done customization for SL1 layer related workflow, during this time customized the workflow and worked without any issues.
Actually defining the Calendar using this Step-I is enough, even though this setup exist also we will get the same error some times, as mentioned in the following case.


I had developed a new workflow for my client, and while working with that workflow again had faced the same Target date issue. [The Step-I setup already exist]

Then I had followed the Step-II
Step-II
Open the same Calendar form from the Basic module.

Now click on the Menu item Working times on the above form.
It will open the following form and on that from click on Menu item Compose working times.

It will open the dialog box, specify the date ranges and click on OK button of the dialog box

Observer the newly created work items, all are created with the Closed status as shown in below figure.

With this closed status also, we will get same Target date error.



So now we need to make change the status of these work items from Close to Open by using the following Job.
static void workCalendarUpdateJob(Args _args)
{
    WorkCalendarDate    WorkCalendarDate;
    ;
    ttsbegin;
    update_recordset WorkCalendarDate
        setting WorkTimeControl = WorkTimeControl::Open
        where WorkCalendarDate.CalendarId == "AdvaliTest";
    ttscommit;
}

I had completed the Workflow successfully, after this Step-II setup.


Start workflows manually without batch jobs configured in AX2012.


static void WorkflowManually(Args _args)
{
    SysWorkflowMessageQueueManager  queueManager;
    WorkflowWorkItemDueDateJob      workItemDueDateJob;
    ;
    queueManager = SysWorkflowMessageQueueManager::construct();
    queueManager.run();

    workItemDueDateJob = new WorkflowWorkItemDueDateJob();
    workItemDueDateJob.run();

}


No comments:

Post a Comment