Microsoft Dynamics AX – error when trying to save an invoice line or submitting a PO to workflow

Sometimes when a user tries to save an invoice line or submit a PO he gets error: ” An error occurred during update. The State of the source document or source document line could not be updated”

The following query in this scenario triggers a query that access the TaxUncommited table.

crossCompany * from sourceDocumentLineMap

                where sourceDocumentLineMap.SourceDocumentLine == this.RecId;

When the crossCompany keyword is present, the data access stack will check to see if the user has access to this table through any of its roles. Since none of the roles have permission to this table, the permission check will return NoAccess, and therefore the query doesn’t return any result.

To fix this issue you need to add the Read permission to table TaxUncommited for the Purchasing Agent role