Wednesday, January 31, 2018

Workflow Batch Error: "Failed to find workflow"

Resolution:

Note: Before running in any AX environment, Take backup of table and data from SQL for the table(SYSWORKFLOWMESSAGETABLE)

Code snippet:

static void San_WkfjobError(Args _args)
{
    SysWorkflowMessageTable sysWorkflowMessageTable;
    SysWorkflowTable sysWorkflowTable;
    ;
    ttsBegin;
    while Select forupdate sysWorkflowMessageTable
        Where sysWorkflowMessageTable.MESSAGELIFECYCLESTATE == 1 
            && sysWorkflowMessageTable.ROOTCORRELATIONID
        notexists join sysWorkflowTable
            where sysWorkflowTable.RootCorrelationId == sysWorkflowMessageTable.RootCorrelationId
    {
        info(strFmt("%1,%2",sysWorkflowMessageTable.RecId,sysWorkflowMessageTable.AssignedUser));
        sysWorkflowMessageTable.MESSAGELIFECYCLESTATE = 2;
        sysWorkflowMessageTable.update();
    }
    ttsCommit;
}

No comments:

Post a Comment

Copy Markup charges while posting purchase invoice using X++

 Copy Markup charges while posting purchase invoice using X++ Class: Important: Code logic is just for Reference.  New class => Duplicate...