Ax 2012 Workflow Exception: Token StartElement in state Epilog would result in an invalid XML document.

At work we developed a quite simple Sales Order Approval workflow for a customer running Dynamics Ax 2012 R2. The workflow artifacts compiled without error and the workflow was configured. However, every time a sales order was submitted to the workflow we were facing an error:

Ax 2012 Workflow Error

A detailed look at the artifacts in the AOT reviled the problem. The Workflow Document class referred to a Query.

Workflow Document Class

The query had a SalesTable Datasource, but the SalesLine was not added as Sub Datasource within the SalesTable. Therefor the system could not generate a valid XML document.

Query with 2 data sources

We moved the SalesLine Datasource to the Sub Datasources of the SalesTable. Finally we compiled the project in X++ and IL and restarted the AOS.

Corrected workflow query

Finally the workflow completed successfully

Dynamics Ax 2012 Workflow completed

About erpcoder
Software Engineer and Dynamics AX enthusiast working in Research & Development for InsideAx

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: