重新启动WF活动时EDA_ITEMS_UPDATE存储过程中的Tridion工作流错误

时间:2012-11-15 10:24:49

标签: workflow tridion tridion-2011

每当工作流程的2个或更多实例重新启动时,我就会遇到错误。我们在办公室的网络事件中暂停了工作流程。这是一个脚本超时,中断了进程。我无法重现此超时,因此我尝试重新启动工作流程活动以完成此过程。但是,当我重新启动超过1个挂起活动时,我收到此错误(完整日志远远低于以下):

Cannot insert the value NULL into column 'ITEM_ID', table 'tridion_cm.dbo.ITEM_ASSOCIATIONS'; column does not allow nulls. INSERT fails.
The statement has been terminated.

重新启动活动并让它一个接一个地完成没有问题。

完整事件日志:

An error occurred while executing the Workflow script.
The Script Engine returned the following information:

SOURCE:

    Line = 0
    Column = 0
    Number = -2147220673
    Source = Component.Save
    Description = 
<?xml version="1.0" standalone="yes"?>
<tcm:Error ErrorCode="8004033F" Category="4" Source="Kernel" Severity="1" xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
    <tcm:Line ErrorCode="8004033F" Cause="false" MessageID="16137"><![CDATA[Unable to save Component (tcm:5-32795).]]>
        <tcm:Token>RESID_4574</tcm:Token>
        <tcm:Token>RESID_4418</tcm:Token>
        <tcm:Token>tcm:5-32795</tcm:Token>
    </tcm:Line>
    <tcm:Line ErrorCode="8004033F" Cause="true">CDATA[No data found. ETA_ITEMS, U Cannot insert the value NULL into column 'ITEM_ID', table 'tridion_cm.dbo.ITEM_ASSOCIATIONS'; column does not allow nulls. INSERT fails. The statement has been terminated.
    </tcm:Line>
    <tcm:Line ErrorCode="8004033F" Cause="false"><![CDATA[A database error occurred while executing Stored Procedure "EDA_ITEMS_UPDATE".]]>
        <tcm:Token>EDA_ITEMS_UPDATE</tcm:Token>
    </tcm:Line>
    <tcm:Details>
        <tcm:CallStack>
            <tcm:Location>System.Data.SqlClient.SqlConnection.OnError(SqlException,Boolean)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.SqlInternalConnection.OnError(SqlException,Boolean)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(</tcm:Location>
            <tcm:Location>System.Data.SqlClient.TdsParser.Run(RunBehavior,SqlCommand,SqlDataReader,BulkCopySimpleResultSet,TdsParserStateObject)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader,RunBehavior,String)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior,RunBehavior,Boolean,Boolean)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior,RunBehavior,Boolean,String,DbAsyncResult)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult,String,Boolean)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.SqlCommand.ExecuteNonQuery()</tcm:Location>
            <tcm:Location>Tridion.ContentManager.Data.AdoNet.DatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
            <tcm:Location>Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
            <tcm:Location>Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
            <tcm:Location>Tridion.ContentManager.Data.AdoNet.IdentifiableObjectDataMapper.Tridion.ContentManager.Data.IIdentifiableObjectDataMapper.Update(IdentifiableObjectData)</tcm:Location>
            <tcm:Location>Tridion.ContentManager.IdentifiableObject.Save(SaveEventArgs)</tcm:Location>
            <tcm:Location>Tridion.ContentManager.ContentManagement.VersionedItem.Save(Boolean)</tcm:Location>
            <tcm:Location>Tridion.ContentManager.ContentManagement.VersionedItem.Save()</tcm:Location>
            <tcm:Location>Tridion.ContentManager.BLFacade.ContentManagement.VersionedItemFacade.UpdateAndCheckIn(UserContext,String,Boolean,Boolean)</tcm:Location>
            <tcm:Location>XMLState.Save</tcm:Location>
            <tcm:Location>Component.Save</tcm:Location>
        </tcm:CallStack>
    </tcm:Details>
</tcm:Error>
    HelpFile = 
    HelpContext = 1000440
caused by: Component.Save
and description: 
<?xml version="1.0" standalone="yes"?>
<tcm:Error ErrorCode="8004033F" Category="4" Source="Kernel" Severity="1" xmlns:tcm="http://www.tridion.com/ContentManager/5.0">
    <tcm:Line ErrorCode="8004033F" Cause="false" MessageID="16137"><![CDATA[Unable to save Component (tcm:5-32795).]]>
        <tcm:Token>RESID_4574</tcm:Token>
        <tcm:Token>RESID_4418</tcm:Token>
        <tcm:Token>tcm:5-32795</tcm:Token>
    </tcm:Line>
    <tcm:Line ErrorCode="8004033F" Cause="true">CDATA[No data found. ETA_ITEMS, U Cannot insert the value NULL into column 'ITEM_ID', table 'tridion_cm.dbo.ITEM_ASSOCIATIONS'; column does not allow nulls. INSERT fails. The statement has been terminated.
    </tcm:Line>
    <tcm:Line ErrorCode="8004033F" Cause="false"><![CDATA[A database error occurred while executing Stored Procedure "EDA_ITEMS_UPDATE".]]>
        <tcm:Token>EDA_ITEMS_UPDATE</tcm:Token>
    </tcm:Line>
    <tcm:Details>
        <tcm:CallStack>
            <tcm:Location>System.Data.SqlClient.SqlConnection.OnError(SqlException,Boolean)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.SqlInternalConnection.OnError(SqlException,Boolean)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(</tcm:Location>
            <tcm:Location>System.Data.SqlClient.TdsParser.Run(RunBehavior,SqlCommand,SqlDataReader,BulkCopySimpleResultSet,TdsParserStateObject)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader,RunBehavior,String)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior,RunBehavior,Boolean,Boolean)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior,RunBehavior,Boolean,String,DbAsyncResult)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult,String,Boolean)</tcm:Location>
            <tcm:Location>System.Data.SqlClient.SqlCommand.ExecuteNonQuery()</tcm:Location>
            <tcm:Location>Tridion.ContentManager.Data.AdoNet.DatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
            <tcm:Location>Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
            <tcm:Location>Tridion.ContentManager.Data.AdoNet.Sql.SqlDatabaseUtilities.ExecuteNonQuery(StoredProcedureInvocation)</tcm:Location>
            <tcm:Location>Tridion.ContentManager.Data.AdoNet.IdentifiableObjectDataMapper.Tridion.ContentManager.Data.IIdentifiableObjectDataMapper.Update(IdentifiableObjectData)</tcm:Location>
            <tcm:Location>Tridion.ContentManager.IdentifiableObject.Save(SaveEventArgs)</tcm:Location>
            <tcm:Location>Tridion.ContentManager.ContentManagement.VersionedItem.Save(Boolean)</tcm:Location>
            <tcm:Location>Tridion.ContentManager.ContentManagement.VersionedItem.Save()</tcm:Location>
            <tcm:Location>Tridion.ContentManager.BLFacade.ContentManagement.VersionedItemFacade.UpdateAndCheckIn(UserContext,String,Boolean,Boolean)</tcm:Location>
            <tcm:Location>XMLState.Save</tcm:Location>
            <tcm:Location>Component.Save</tcm:Location>
        </tcm:CallStack>
    </tcm:Details>
</tcm:Error>
Source:
    LogScriptError

工作流信息

组件是由另一个应用程序通过BusinessConnector新创建的。它在完成活动之前执行修订保存。 WF的目标是

  1. 根据其他系统的文本值分配必要的组件链接;
  2. 创建页面;
  3. 并将其发布到目标。
  4. 我知道这可以通过其他方式更好地完成,但现在就是这样,请接受实施。

    模型/架构

    Product
        - modelName (text)
        - categoryName (text)
        - categoryCL (component link)
        - statusName (text)
        - statusCL (component link)
        - blah1 (text)
        - blah2 (text)
        - blah3 (text)
        - blah4 (text)
    

    自动活动脚本:

    ' COMPONENT WORKFLOW for PRODUCT SCHEMA (START)
    
    ' Load common functions
    ExecuteGlobal oTDSE.GetObject("/webdav/200%20Design/Building%20Blocks/Library/Design/Workflow/Common/Workflow%20Functions.tbbs", 1).Content
    
    ' Initialize
    Set objComp = CurrentWorkItem.GetItem()
    Set oContentPub = objComp.Publication
    Set oWebsitePub = oTDSE.GetObject(GetStagingLangPub("EN", "website1"), 1)
    modelName = objComp.Fields.Item("modelName").Value.Item(1)
    
    ' Search and Assign component links based on some text fields from BC client
    Set compListRowFilter = oTDSE.CreateListRowFilter()
    Call compListRowFilter.SetCondition("ShowNewItems", TRUE)
    Call compListRowFilter.SetCondition("ItemType", 16)
    
    ' Assign the first component link (categoryCL)
    categoryName = objComp.Fields.Item("categoryName").Value.Item(1)
    Set categoryComp = GetObjectFromFolder(categoryName, oTDSE.GetObject(categoryFolderWebDav, 1), compListRowFilter)
    If Not categoryComp is Nothing Then
        objComp.Fields.Item("categoryCL").Value.RemoveAll
        objComp.Fields.Item("categoryCL").Value.Add(categoryComp)
        Call objComp.Save(True)
    Else
        Call SendNoObjectEmail("Category", categoryName, "categoryCL", GetEmailsFromGroup(oContentPub, categoryOwner), "")
    End if
    
    ' Assign the second component link (statusCL)
    statusName = objComp.Fields.Item("statusName").Value.Item(1)
    Set statusComp = GetObjectFromFolder(statusName, oTDSE.GetObject(statusFolderWebDav, 1), compListRowFilter)
    If Not statusComp is Nothing Then
        objComp.Fields.Item("statusCL").Value.RemoveAll
        objComp.Fields.Item("statusCL").Value.Add(statusComp)
        Call objComp.Save(True)
    Else
        Call SendNoObjectEmail("Status", statusName, "statusCL", GetEmailsFromGroup(oContentPub, statusOwner), "")
    End if
    
    ' Create a page with the component in WF
    Set oPage = CreateDefaultPage(modelName, oWebSitePub, SaveToFolderWebDav, PageTemplateWebDav)
    Call oPage.ComponentPresentations.Add(oWebSitePub, oTDSE.GetObject(ComponentTemplateWebDav, 1))
    oPage.Save(True)
    
    ' Publish the page
    ....
    
    ' Send email
    ....
    
    ' Finish the Activity
    Call CurrentWorkItem.ActivityInstance.FinishActivity("someMsg")
    
    ' COMPONENT WORKFLOW for PRODUCT SCHEMA (END)
    

    我没有放大到确切发生的位置,但我认为它是categoryCL或statusCL的objComp.Save(True)行。

2 个答案:

答案 0 :(得分:1)

我注意到您正在呼叫Call objComp.Save(True) - “True”参数强制“CheckIn”,因为它意味着“完成编辑”。

看起来这可能会发生两次(即如果有statusCL和categoryCL)可能会导致问题。我会尝试更改行为,以便在完成更改时仅在最后调用Save()方法,而不是保存两次。

答案 1 :(得分:0)

从我看到的问题是你试图将空值分配为组件链接。你确定你没有尝试将这两个组件相互链接吗?可能是您尝试创建的链接是工作流中的新组件(它还没有签入版本),因此您无法创建指向它的链接。尝试在脚本中添加一些日志记录,这样我们就能看到它失败的确切位置以及参数是什么。

我同意弗兰克的看法,这个例外值得一个缺陷报告。