Workflow: invalid tracking submission expected context %1 and expected type %2 actual context %3 and actual type %4

January 27, 2020 at 16:25
filed under Dynamics AX
Tagged , , , ,

You can get this error in the Workflow message processing batch job. You will find that the workflow batch throws this error every 10 minutes or so. The reason you get it every 10 minutes is because of the code in the SysWorkflowMessageQueueManager.expireLeasedMessages() method. In this method, the workflow updates the batch affinity value every 10 minutes.

To debug this issue, you might be tempted to process the workflow messages using the the Tutorial_BatchProcessing form. However, you will not be able to debug this using the Dynamics AX debugger because this form executes the function that fails in CIL. You will have to use Visual studio to debug it.
To debug using the Dynamics AX debugger, use the following job:

static void procesworkflowqueue(Args _args)

Set your breakpoints in the table method workflowtrackingtable.savetracking() on line 161 and/or 154. These are the lines that throw an error message with label @SYS112531.
Wait for about 9 minutes after the workflow batch has the status error, then run the job every 2 seconds manually. After about 1 minute of this you will enter the breakpoint. Then use the debugger to figure out what record in the table SYSWORKFLOWMESSAGETABLE is causing the error.
You could also find it using the following query:


This query returned more records than were causing the issue in my case, so it’s best to make sure using the debugger. I then “fixed” the issue by deleting the identified record from the SYSWORKFLOWMESSAGETABLE table.

If you run the Tutorial_WorkflowProcessinng class and you get the error every time, there might be something wrong with records in the table WORKFLOWWORKITEMTABLE instead. You can figure out what record this is using the debugger as well.

Most likely the work item is linked to a tracking status record that does no longer exist. Verify this using this query:

WHERE correlationid NOT IN (

You can try to get it working by recalling the worklow and resubmitting it. If that doesn’t work you can delete the record in the WorkflowWorkitemTable table.

Unfortunately, I do not know the root cause of this issue but the actions above fixed it for me. Hope this helps. Thanks to the community for inspiration on how to fix this issue.

no comments

RSS / trackback