Sunday, May 08, 2016

AX2012 Deleting a workflow instance

Had this strange issue where we found that the RECID got maxed out for certain tables in the systemsequences table. This caused the system to turn unusable and the logins into the system got disabled unless the NEXTVAL was correct set again using SQL.

On investigation and careful monitoring we found that the workflow engine has lots of instances where the workflow was in pending status. We realized that this was a developer issue where the business record was getting approved on the first work item approval on the attached workflow. As a result the user was able to post the data without completing the workflow.

Another issue we found was that there were multiple instances created for the same record this happened as the system dialog for workflow comments was not modal and went in the background and the user was able to submit twice.

Due to the above issues we landed in a situation where we have lots of workflow instance to get rid of and hence this post.

The workflow instance related tables are identified as follows
  • SysWorkflowInstanceTable
  • SysWorkflowTable
  • WorkflowQueueDocumentCommonFlds
  • WorkflowTrackingArgumentTable
  • WorkflowTrackingCommentTable
  • WorkflowTrackingStatusTable
  • WorkflowTrackingTable
  • WorkflowTrackingWorkItem
  • WorkflowWorkItemTable

I have already created a class to save some of the work

Wednesday, May 04, 2016

Truncate log without backup

So often in the non production environments we require the database logs to be truncated and the backup in these cases really does not matter.

As the truncate only option has been removed by Microsoft to avoid misuse of the command, there still is a workaround to shrink the transcation log without having to actually back it up.

The trick is to backup the log to a nul disk as shown below
BACKUP LOG MicrosoftDynamicsAX_model TO DISK='NUL:'
dbcc shrinkfile( MicrosoftDynamicsAX_model_log, 0 )
BACKUP LOG MicrosoftDynamicsAX TO DISK='NUL:'
dbcc shrinkfile( MicrosoftDynamicsAX_log, 0 )

Sunday, May 01, 2016

Failed to create a session; confirm that the user has the proper privileges to log on to Microsoft Dynamics

We started to get this message in the workflow one fine day.

On investigation it was realized that the issue was occurring for all the workflows which were directed to a particular user. The user has all the required permissions as well.

On further investigation it was found that for some reason the SID link between the active directory and the user info stored in AX was broken. When i tried to click the default company link on the user info i got the below message.


So i deleted the user, imported the user again from active directory and gave the same permissions back. Also established the user link with the employee record. Resumed the workflows and things were back on track.