Dynamics AX Workflow Error: Specified argument was out of the range of valid values Parameter name: constraintDate.

26 07 2010

I’m was busy modifying a pre-existing workflow template of mine, by adding an additional task. I decided that the task should not be contrained by any due dates, so I didn’t provide any Due Date Provider for my task. I was able to re-configure my workflow with the new task without any issues. However after submitting my record, my workflow history reflected that my task had been started, but no users were assigned. Debugging my workflow revealed that the Participant Provider was functioning correctly and returning the correct user, but yet my workitem was not being assigned. On further investigation the event log on the IIS server revealed the following message:

Workflow instance: 6f5ac316-52b3-48f0-b401-93af89889a21 was terminated for the following reason: Specified argument was out of the range of valid values.
Parameter name: constraintDate.

Now I’m not sure what the real cause of the problem is, but after adding a Due Date Provider to my task and re-configuring accordingly the workitem was successfully assigned.  Hopefully I will come to a conclusion as to why I am unable to leave the Due Date Provider property empty sometime in the future, but for the moment this is a successful work around for my issue.

Happy Daxing.





Reset Delegate Due Date

17 06 2010

Dynamics AX 2009 workflow has functionality built in by default to delegate work-items to new users. But what happens if your workitem is about to escalate when you delegate? The new assignee may only have a very short time to action the item. So if you want to reset the due date time of work-items on delegation, here is a quick and dirty way to get it right. Be warned, this is modifying a framework class so you will need to be careful when upgrading.

Class SysWorkflowEventDispatcher::onWorkitemDelegate

//Declare Variable (line 23)
WorkflowDateTimeTemp _dueDate;
//Generate and set new due date (approx line 114) after Setting description, before notifying assignee
_dueDate = SysWorkflowProviderService::resolveDueDate(_workItemContext.parmWorkflowCorrelation().parmWorkflowContext(), stepTable.StepId, workItemTable.UserId);
workItemTable.DueDateTime = DateTimeUtil::newDateTime(_dueDate.parmWorkflowDate(), _dueDate.parmWorkflowTime());

//notify the assignee
notification = EventNotificationWorkflow......

Happy Daxing





Calendars in Workflow

10 06 2010

If you have been using Dynamics AX workflow for a while, you would have noticed that calendars and times form quite an intricate part of how workflows are managed.

They are used to determine amongst other things:

  • How long workitems are assigned to users
  • When escalation should occur
  • How long before escalation steps should last before causing final actions

One of the ways to specify the timing for the above is by using calendars in AX.  In this post we will do a quick walk-through of how to setup a calendar for use in your workflow.

Step 1- Setup working time template
Note: Working time templates provide a way to define standard working times for your company from which various calendars can be created and customized.

  • Open an Dynamics AX client and navigate to Basic -> Setup -> Calendar -> Working time templates.
  • Click new and give your template a name and description e.g. Workflow (Working times used by workflow)
  • Click on the Monday tab, click new and set the operating times for your company e.g. 8:00 am to 5pm. (You can always specify 2 or more operating time records per day if you take lunch or would like that to be taken into account for workflow).
  • If you use the same operating times for each day in the week, click the copy day button on the right hand side and copy the times to each day one at a time.
  • If you have differing operating times per day, follow the above procedure for each of the day tabs.
  • Close your form.

Step 2 – Create your calendar

  • Navigate to Basic -> Calendar.
  • Click new and give your calendar  a name.
  • Create your working times for this calendar by clicking on the working times button.
  • On the Working times screen click the ‘Compose working times’ button.
  • Select the dates for which you would like to create working times for. Make sure you create enough future dates so that your workflow date assignments will always resolve otherwise you may get an stopped error. I recommend at least one year (default) or more.
  • Note: You can set up a batch task (via the batch tab) to run periodically to keep your calendar refreshed with new dates .
  • Select the working time template that you created in step 1 and click OK. You should now see a list of working times composed for your calendar.
  • You have now setup your calendar and can use it within all your workflow configurations.

Happy Daxing.

P.S. As a side note for developers, if you haven’t defined a DueDateProvider for your Workflow template you will not get the option to define due dates when configuring.





Stopped (error): Target date not found in work calendar

15 01 2010

Just got the error “Stopped (error): Target date not found in work calendar” in my workflow history for a workitem. To fix it ensure that there are sufficient working times composed for the calendar selected in your workflow configuration. Ensure that there are enough OPEN calendar dates for your workitems to resolve successfully as well.

Update: I created a post on how to setup your calendar here.








%d bloggers like this: