4

每当重新启动工作流的 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. 并将其发布到目标。

我知道这可以通过其他方式做得更好,但现在就是这样,请耐心等待。

模型/架构

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)行。

4

2 回答 2

1

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

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

于 2012-11-16T14:14:21.460 回答
0

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

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

于 2012-11-16T07:42:48.667 回答