Wednesday 8 February 2017

Dynamics AX 2012 Workflow receives "Failed to find workflow" error

We have run across a few situations in Dynamics AX 2012 where the workflow batch job fails with the error "Failed to find workflow" message.  When the customer received this error it prevented the remaining workflow messages in the queue from being processed.  In order to process all of the items that were queued up we needed to complete the following steps:

1.  Identify the record(s) that are causing the batch to fail.
Select a.RECID from SYSWORKFLOWMESSAGETABLE a Where a.ROOTCORRELATIONID notin(Select b.ROOTCORRELATIONID fromSYSWORKFLOWTABLE b)and a.MESSAGELIFECYCLESTATE = 1
2.  Dequeue the SYSWORKFLOWMESSAGETABLE records that do not have a corresponding SYSWORKFLOWMESSAGETABLE record.
Update SYSWORKFLOWMESSAGETABLE Set MESSAGELIFECYCLESTATE = 2 where RECID =<RECID returned from statement above>
The procedures above will dequeue the message causing the error and allow the batch to complete.

Note:  As always, ensure you do a proper backup of your existing SYSWORKFLOWMESSAGETABLE prior to attempting this fix.

SysWorkflowMessageTable Table [AX 2012]

The SysWorkflowMessageTable table contains the workflow messages between Microsoft Dynamics AX and Microsoft Workflow Runtime. A message is connected to a workflow instance. The sender stores the message in the table and the receiver does the work requested by the message and removes the message. Messages are stored until the related workflow instance completes or is cancelled.

Methods

 MethodDescription
Gg938509.pubmethod(en-us,AX.60).gifaosValidateDeleteValidates on the server that the specified record can be deleted from a table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifaosValidateInsertValidates on the server that the specified record can be inserted. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifaosValidateReadValidates on the server that the specified record can be read. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifaosValidateUpdateValidates on the server that the specified record can be updated. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifbuf2conPacks the table buffers of an xRecord instance into an X++ container. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifcancelTimeOutCancels a previous method call to the setTimeOut method. (Inherited from Object.)
Gg938509.pubmethod(en-us,AX.60).gifcanSubmitToWorkflowIndicates whether submission to workflow is possible. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifcaptionGets and sets the caption property of a table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifcheckInvalidFieldAccessGets and sets invalid field access. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifcheckRecordGets and sets the property that indicates whether to check mandatory fields. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifcheckRestrictedDeleteActionsGets and sets the property that indicates whether a record can be deleted. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifclearRemoves all rows from the table buffer. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifcompanyGets and sets the property that indicates a legal entity for the record. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifcon2bufUnpacks a container into the table buffers. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifconcurrencyModelGets and sets the default concurrency model to use to update records. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifcontextGets and sets the context property. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifdataRetrieves a row from the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifdataSourceRetrieves the data source of the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifdefaultFieldPopulates default values in a field in the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifdefaultRowPopulates default values in fields in the table in the non-interactive case. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifdeleteDeletes the current record from the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifdisableCacheGets and sets the property that indicates whether caching is disabled. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifdisposeReleases resources that are used by the xRecord object. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifdoClearRemoves all rows from the table buffer and bypasses any additional logic in the clear method of the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifdoDeleteDeletes the current record from the table and bypasses any additional logic in the delete method of the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifdoInsertInserts the record into the table and bypasses any additional logic in the insert method of the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifdoUpdateUpdates the current record and bypasses any additional logic in the update method of the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifdoValidateDeletePerforms the action to validate that a record can be deleted. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifequalDetermines whether the specified object is equal to the current one. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).giffieldAccessRightReturns the field access right. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).giffieldBufferAccessRightReturns the field access right for the current record. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).giffieldStateSets or returns the state of a field in the table buffer. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifgetAllowRedefaultReturns the list of fields that are allowed to re-default. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifgetDefaultingDependenciesReturns the container that holds defaulting dependencies. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifgetExtensionReturns the table extension. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifgetFieldValueGets the value of the specified field from a table buffer. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifgetInstanceRelationTypeReturns the table name that corresponds to the InstanceRelationType ID. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifgetPhysicalTableNameReturn the physical table name, which, in the case of the SQL Temp DB table, is the table instance name. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifgetPresenceFieldDataRetrieves the PresenceInfo value from the specified field. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifgetSQLStatementGets the SQL statement that is used to return records from the database. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifgetTableInInstanceHierarchy(Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifgetTableTypeIndicates the type of the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifgetTimeOutTimerHandleReturns the timer handle for the object. (Inherited from Object.)
Gg938509.pubmethod(en-us,AX.60).gifhandleRetrieves the handle of the class of the object. (Inherited from Object.)
Gg938509.pubmethod(en-us,AX.60).gifhasRelatedTableIndicates whether a foreign key constraint buffer is linked with the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifhelpFieldRetrieves a string that contains the Help text for the specified field. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifinitValueInitializes a field to the default value. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifinputStatusSets or returns the current input status of the table buffer. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifinsertInserts the record into the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifinteractiveContextSets or returns the current interactive context of the table buffer. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifisFieldDataRetrievedChecks whether the data of the given field has been retrieved. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifisFieldSetChecks whether a field has a Set or Defaulted state. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifisFormDataSourceIndicates whether the data source is a form. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifisNewRecordReturns true if the record is a new record that hasn't been persisted yet. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifisPartOfUOWSaveChanges(Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifisTempDbIndicates whether the type of the table is SQL TempDB. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifisTmpIndicates whether this is a temporary table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifjoinChildFinds the join child of the current record. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifjoinParentFinds the join parent of the current record. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).giflinkPhysicalTableInstanceChecks whether there is a link for the physical table instance for the record. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifmergeMerges the current table with the specified table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifmodifiedFieldModifies the specified field to the original. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifmodifiedFieldValueModifies the specified field to the original value. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifnewInitializes a new instance of the Object class. (Inherited from Object.)
Gg938509.pubmethod(en-us,AX.60).gifnotifyReleases the hold on an object that has called the wait method on this object. (Inherited from Object.)
Gg938509.pubmethod(en-us,AX.60).gifnotifyAllReleases a lock on the object that was issued by the wait method on this object. (Inherited from Object.)
Gg938509.pubmethod(en-us,AX.60).gifobjectOnServerDetermines whether the object is on a server. (Inherited from Object.)
Gg938509.pubmethod(en-us,AX.60).giforigRetrieves the original values of the current record. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifoverwriteSystemfieldsGets and sets the property that indicates whether system fields can be overwritten. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifownerReturns the instance that owns the object. (Inherited from Object.)
Gg938509.pubmethod(en-us,AX.60).gifpostCacheLoadIs executed after data is hit from the cache for the select operation on the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifpostLoadIs executed after a record is read. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifpreRemotingIs executed before a cross-tier call is about to be executed for the table that would pack its state to the other tier. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifqueryTimedOutIndicates whether the query exceeded the time limit for execution. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifqueryTimeoutGets and sets the property that indicates the time limit for the execution of a query. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifreadCommittedLock(Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifreadPastGets and sets the property that indicates whether to skip rows that are locked by other processes when a record is read. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifrecordLevelSecurityGets and sets the property that indicates whether to apply security on a record level. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifrelatedTableSets or returns the related buffer of a link of a table buffer. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifrenamePrimaryKeyRenames the foreign keys in other tables according to the change of the corresponding primary key value in this table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifrereadRereads the record from the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifRowCountRetrieves the number of rows in the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifselectForUpdateGets and sets the property that indicates whether to select records for update when they are read. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifselectLockedIndicates whether to select locked records. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifselectRefRecordSelects the record by referenced field ID. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifselectWithRepeatableReadGets and sets the property that indicates whether repeatable read is enabled. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifsetConnectionSets the user connection for this table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifsetCrossPartitionSets or resets cross-partitioning for the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifsetFieldValueSets the field value in the record buffer. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifsetSQLTracingEnables or disables SQL tracing mode. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifsetTimeOutSets up the scheduled execution of a specified method. (Inherited from Object.)
Gg938509.pubmethod(en-us,AX.60).gifsetTmpSets the table so that it is not persisted to the database. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifsetTmpDataSets the contents of the temporary table to the specified data. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifsetXDSContextSets new XDS context. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifskipAosValidationGets and sets the property that indicates whether to skip validation of Microsoft Dynamics AX Application Object Server (AOS). (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifskipDatabaseLogGets and sets the property that indicates whether to skip database log requests. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifskipDataMethodsGets and sets the property that indicates whether to discard overloaded methods. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifskipDeleteActionsGets and sets the property that indicates whether to skip delete actions on the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifskipDeleteMethodGets and sets the property that indicates whether to discard overloaded methods. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifskipEventsProvides an option to turn off calling the Application.event* methods for the lifetime of an xRecordobject. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifskipPostLoadGets and sets the property that indicates whether to skip executing the xRecord.postLoad method on the table. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifskipTTSCheckGets and sets the property that indicates whether to skip the check to determine whether the record is selected for update. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifsuppressWarningsGets and sets the property that indicates whether to suppress warnings for this pointer. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).giftableAccessRightReturns the table access right. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).giftableBufferAccessRightReturns the table access right for the current record. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).giftakeOwnershipOfTempDBTable(Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).giftoolTipFieldRetrieves the HelpText value for the specified field. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).giftoolTipRecordRetrieves the ToolTip value for the current record. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).giftoStringReturns a string that represents the current object. (Inherited from Object.)
Gg938509.pubmethod(en-us,AX.60).gifttsabortAborts a transaction that was started by a call to the ttsbegin method. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifttsbeginStarts a transaction that can be either committed by the ttscommit method or aborted by the ttsabort method. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifttscommitCommits a transaction that was started by a call to the ttsbegin method. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifupdateUpdates the current record. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifusageCountRetrieves the current number of references (the value of the reference counter) that the object has. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifuseExistingTempDBTable(Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifvalidateDeleteDetermines whether the current record is valid and ready to be deleted from the database. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifvalidateFieldDetermines whether the specified field is valid. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifvalidateFieldValue(Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifvalidateWriteDetermines whether the current record is valid and ready to be written. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifvalidTimeStateUpdateModeSets a valid time state update mode on the cursor. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifwaitPauses a process. (Inherited from Object.)
Gg938509.pubmethod(en-us,AX.60).gifwasCachedSpecifies the location from which the data was retrieved. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifwriteUpdates a record if it exists; otherwise, inserts a record. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gifxmlRetrieves an XML string that represents the current object. (Inherited from xRecord.)
Gg938509.pubmethod(en-us,AX.60).gif Gg938509.static(en-us,AX.60).gif::existIndicates whether the specified record in the SysWorkflowMessageTable table exists.
Gg938509.pubmethod(en-us,AX.60).gif Gg938509.static(en-us,AX.60).gif::findByActivityFinds the specified record in the WorkflowMessageTable table.
Gg938509.pubmethod(en-us,AX.60).gif Gg938509.static(en-us,AX.60).gif::findByCorrelationFinds the specified record in the WorkflowMessageTable table.
Gg938509.pubmethod(en-us,AX.60).gif Gg938509.static(en-us,AX.60).gif::findByMessageId
Gg938509.pubmethod(en-us,AX.60).gif Gg938509.static(en-us,AX.60).gif::findQueuedFinds the specified record in the WorkflowMessageTable table.
Gg938509.pubmethod(en-us,AX.60).gif Gg938509.static(en-us,AX.60).gif::initFromWorkflowMessageMicrosoft internal use only.
Top

Fields

FieldTypeConfiguration keyDescription
ActionNameExtended Data Type:WorkflowOutcomeName
Type: String
NoneName of application object.
ActivityContextTypeEnumeration:WorkflowActivityContextTypeNoneThe workflow activity context type
ActivityInstanceIdExtended Data Type:WorkflowActivityInstanceId
Type: Guid
NoneActivity ID identifies a workflow activity. For example. a workflow task.
AssignedUserExtended Data Type:WorkflowAssignedUser
Type: String
NoneThe user assigned a return or request change work item.
AxaptaUserExtended Data Type:WorkflowUser
Type: String
NoneWorkflow User contains Microsoft Dynamics AX user name.
BatchAffinityExtended Data Type:WorkflowMessageBatchAffinity
Type: Guid
NoneThe batch affinity identifies the group of workflow messages being process instance of a workflow batch task.
BookmarkExtended Data Type:WorkflowBookmarkId
Type: Guid
NoneWorkflow runtime internal bookmark identifier
ConfigurationIdExtended Data Type:WorkflowConfigurationId
Type: Guid
NoneWorkflow ID identifies a workflow and its versions.
dEL_ModifiedTimeExtended Data Type:DEL_ModifiedTime
Type: Integer
None(This field applies only to the following version(s): Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2 (SYS))
MessageIdExtended Data Type:WorkflowMessageId
Type: Guid
NoneIdentifies a workflow message
MessageLifeCycleStateEnumeration:WorkflowMessageLifeCycleStateNoneMessage Life Cycle State identifies the life cycle state of workflow message.
MessageTypeEnumeration:WorkflowMessageTypeNoneMessage Type identifies the type of a workflow message (e.g. Activation, WorflowStarted etc.).
modifiedDateTimeExtended Data Type:ModifiedDateTime
Type: UtcDateTime
None
ParentCorrelationIdExtended Data Type:WorkflowParentCorrelationId
Type: Guid
NoneThe parent workflow correlation identity.
PartitionExtended Data Type: Partition
Type: Int64
None(This field applies only to the following version(s): Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2 (SYS))
RecIdExtended Data Type: RecId
Type: Int64
None
recVersionExtended Data Type:RecVersion
Type: Integer
None
RootCorrelationIdExtended Data Type:WorkflowRootCorrelationId
Type: Guid
NoneThe root workflow correlation identity.
SubWorkflowIdExtended Data Type:WorkflowSubWorkflowId
Type: Guid
NoneIdentification of the subworkflow
WorkflowContextCompanyIdExtended Data Type:CompanyId
Type: String
NoneCompany ID is the initials of the company accounts.
WorkflowContextRecIdExtended Data Type:WorkflowContextRecId
Type: Int64
NoneIdentifies the data record associated with the workflow.
WorkflowContextTableIdExtended Data Type:WorkflowContextTableId
Type: Integer
NoneIdentifies the data table containing the data record associated with the workflow.
WorkflowCorrelationIdExtended Data Type:WorkflowCorrelationId
Type: Guid
NoneCorrelation ID identifies a workflow instance.
WorkItemInstanceIdExtended Data Type:WorkflowWorkItemInstanceId
Type: Guid
NoneWorkItem ID identifies a work item.
Top

Relations

RelationTableLines
DataAreaDataArea
MessageIdSysWorkflowMessageTable
PartitionPartitions
UserInfoUserInfo
UserInfo1UserInfo
WorkflowVersionTableWorkflowVersionTable
WorkflowWorkItemTableWorkflowWorkItemTable
Top

Indexes


IndexAllowDuplicatesEnabledFields
ActivityIdxYesYes
BatchAffinityIdxYesYes
CorrelationIdxYesYes
MessageIdxNoYes
ParentCorrelationIdxYesYes
RecIdNoYes
RootCorrelationYesYes

1 comment: