Workflow Configuration Displays Error Icon despite being valid

13 02 2018

I’ve recently found a scenario where my workflow configuration has an “invalid” icon next to the workflow configuration, this all despite the latest version being fully validated.


Tracing back the issue it seems that Microsoft displays the “valid/invalid” icon based on the latest workflow version sorted by workflow version “RecId” (See Table: WorkflowTable.validIcon).

So searching the workflow version Table I found an old invalid workflow configuration version (based on modifiedDateTime) that has an out of sync (i.e. newer) RecId than the actual newest versions. Deleting this record resolved the issue.

There should be no issues deleting this invalid version as actual workflow instances can’t be created against invalid versions.

I think the way the icons are displayed is a bug in AX, but so far doesn’t appear to affect too much.


Determine if a document has an outstanding task.

20 05 2015

In AX2009 you used to have two different status for assigned Purchase Requisitions in workflow, namely: “Pending Completion” and “Pending Approval”. Unfortunately in AX2012 this has become simply “In Review” to signify it being in workflow. This allows a more flexible approach to the ordering and reuse of elements in workflow. However it does not provide a clear way to distinguish where the Purchase Requisition is currently in the workflow process especially whether or not the item is currently assigned as a task or an approval.

The code below provides the X++ select statement to determine whether a document in workflow has at least one pending Task based workitem linked to it.

public display NoYes isTask()
  WorkflowWorkItemTable workflowWorkItemTable;
  WorkflowElementTable workflowElementTable;
  select firstonly ElementId from workflowWorkItemTable
    where workflowWorkItemTable.RefTableId == this.TableId &&
    workflowWorkItemTable.RefRecId == this.RecId &&
    workflowWorkItemTable.Status == WorkflowWorkItemStatus::Pending
    join ElementId, ElementType from workflowElementTable
    where workflowElementTable.ElementId == workflowWorkItemTable.ElementId &&
    workflowElementTable.ElementType == WorkflowElementType::Task;
  return (workflowWorkItemTable.RecId == 0) ? NoYes::No : NoYes::Yes;

Note: If you’re using line level workflows or parallel branches you may not be guaranteed that the result is what you are logically looking for. It will simply return if there is at least one pending task workitem linked.

This post was inspired by forum question:

Workflow Types in AX 2012

22 01 2015

Looking for a list of Workflow Types (Templates) available in AX 2012:

Mass Resume Line Workflows

14 11 2014

Orginally from my new blog:

<strong>Challenge/Problem</strong>: Many line level workflows that need to be resumed.

<strong>Description</strong>: Sometimes due to data or setups one may have numerous line level workflows failing and entering a “Stopped” state. This may be a result of calendars that do not have enough dates created, users who have been disabled etc… If the workflows were header level, it is easy enough to select all in the Workflow History form and click resume, however on line level workflows one needs to view each line level workflow individually and resume them.

<strong>Solution</strong>: The following job can be used to perform mass resume on stopped workflows. You can adapt the SQL to limit to certain documents or document types of necessary.
<pre>static void resumeStoppedWorkflows(Args _args)
WorkflowTrackinStatusTable tracking;
int i, j;
while select tracking where tracking.TrackingStatus == WorkflowTrackingStatus::Faulted
&amp;&amp; tracking.WorkflowType == WorkflowTrackingStatusWorkflowType::DependentSubworkflow
try {
Workflow::resumeWorkflow(tracking.CorrelationId, “Auto-resumed”);
catch (Exception::Error)
//Some may not be able to be resumed but we dont want to stop the process
info(strfmt(“%1 workflows resumed, %2 workflows could not be resumed”));

New Blog: Explore

24 07 2014

Hi All.

compass-1I have decided to start a new blog to run alongside where I can capture some of the daily tips and tricks that I’m finding in AX 2012, without polluting this workflow dedicated blog. Please feel free to visit it, subscribe to it, comment on it, like it, share it etc over at

For the moment its very basic but will hopefully get some nice new features in the coming weeks.

Kind Regards

Deleting a workflow Instance in Microsoft Dynamics AX 2012

22 05 2014

Deleting a workflow Instance in Microsoft Dynamics AX 2012

I’ve been wanting to write a tutorial explaining the tables involved in a workflow and how to delete an instance if necessary (e.g. when a major fault or data inconsistency occurs), however it seems Colin’s Dynamics AX 2012 blog beat me to it and he did a superb job at that, check it out here

AX2012 – On Reassign: Failed to create a session

23 01 2014

When trying to reassign a record via workflow history in AX2012 we received the error: Failed to create session; confirm that the user has the proper privileges to log in to Microsoft Dynamics.

Screen Shot 2014-01-23 at 2.31.28 PM

The cause of our problem was a faulty CIL. We performed a full CIL compile, restarted AX and then were then able to perform the re-assign

%d bloggers like this: