Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finishing a Workflow Activity gives "An item with the same key has already been added" error

We have setup a very simple approval workflow for a certain type of content. However, for some reason, the first manual activity couldn't be finished and thus, workflow being blocked.

Any attempt to finish the activity will prompt this error:

An item with the same key has already been added.
Unable to finish the Workflow Activity (tcm:x-xxxxx-xxxxxx)

Here's the data I'm working with (truncated for readability):

<Content xmlns="uuid:fac33fb4-7b36-465a-af40-f3b80c4f3f65">
    <contactlist>
        <name>Lorem ipsum dolor</name>
        <address>sit amet consectetur</address>
        <photo xmlns:xlink="http://www.w3.org/1999/xlink" 
               xlink:type="simple" xlink:href="tcm:5-80196" 
               xlink:title="photo-1"></photo>
        <email>[email protected]</email>
        <phone>interdu eget</phone>
        <mailimage xmlns:xlink="http://www.w3.org/1999/xlink" 
                   xlink:type="simple" xlink:href="tcm:5-80195" 
                   xlink:title="email-icon"></mailimage>
    </contactlist>
    <contactlist>
        <name>Lorem ipsum dolor</name>
        <address>sit amet consectetur</address>
        <photo xmlns:xlink="http://www.w3.org/1999/xlink" 
               xlink:type="simple" xlink:href="tcm:5-80197" 
               xlink:title="photo-2"></photo>
        <email>[email protected]</email>
        <phone>interdu eget</phone>
        <mailimage xmlns:xlink="http://www.w3.org/1999/xlink" 
                   xlink:type="simple" xlink:href="tcm:5-80195" 
                   xlink:title="email-icon"></mailimage>
    </contactlist>
</Content>

Notice that I am reusing the same email-icon image for [mailImage] attribute. I'm inclined to think that this is causing the error because it's the only duplicated component link in the list.

If I remove the mail image component links and finish the activity, it works and I can proceed with the workflow. Odd huh?

I don't see any reason why I can't reuse component links in the same component in regard of workflows being able to proceed. I mean, CMS allowed me to save the component, why not allow me to proceed with Workflow?

EDIT: By the way, this is the error from the Event Logs:

Unable to finish the Workflow Activity (tcm:5-18430-131104)
An item with the same key has already been added.

Error Code:
0x80040000 (-2147221504)

Call stack:
System.ThrowHelper.ThrowArgumentException(ExceptionResource)
System.Collections.Generic.Dictionary`2.Insert(TKey,TValue,Boolean)
System.Collections.Generic.Dictionary`2.Add(TKey,TValue)
Tridion.ContentManager.Workflow.ActivityInstance.SaveBinariesAndGetBinaryIds(String,IDictionary`2)
Tridion.ContentManager.Workflow.ActivityInstance.OnFinishing(FinishActivityEventArgs)
Tridion.ContentManager.Workflow.ActivityInstance.Finish(ActivityFinish)
Tridion.ContentManager.BLFacade.Workflow.ActivityInstanceFacade.FinishActivity(UserContext,String,String,String,String,String,String)
ActivityInstance.FinishActivity
like image 391
Ianthe the Duke of Nukem Avatar asked Aug 15 '12 12:08

Ianthe the Duke of Nukem


1 Answers

THe problem you have is because of your auditing template. It might be the case that you have old (pre 2011) VBScript template as your auditing template. Try switching auditing off, or change auditing templates values in properties of your publication

like image 60
Andrey Marchuk Avatar answered Nov 01 '22 21:11

Andrey Marchuk