Duplicate activity name error when dynamically adding a custom composite activity

I have a sequential document review workflow that when submitted dynamically creates multiple review tasks internally within the workflow. Each review task is an instance of the custom composite activity with a unique name. This all works fine.

I also want to be able to add a review task dynamically at runtime from the host. However, when I attempt to apply the addition to the workflow I get a validation error that states I cannot add activities with duplicate names. This, I believe, is referring to the child activities of my composite activity. I thought I could just give the composite activity a unique name that would be used by child activites for qualification. This is the way it works when creating them within the workflow.

Does anyone know what may be causing this



Answer this question

Duplicate activity name error when dynamically adding a custom composite activity

  • Kapil Kelaiya

    This does look like an issue with dynamic update. Thank you very much for the information. I will look into this issue and let you know of any updates.

    Thanks!



  • eMedia

    From behaviors you're describing it does sound like dynamic update issue, but Angel and I were not able to reproduce it. We tried adding and removing composite custom activities dynamically, and didn't hit this issue.

    Could you please provide more details, like custom activity structure, more of the host code, workflow structure, list of dynamic update validation errors Which build are you using

    I'd also suggest to try not setting Name for the TaskActivity, when performing a dynamic update, so it will be auto generated.

    Thanks a lot the information.



  • Jeffn

    Hello Angel and Andrei,

    The way I originally implemented the workflow was not optimal. Therefore, I redesigned it to use the Replicator activity and implemented dynamic updates to the replicator's child data by handling asynchronous events using the EventHandlingScope activity. This gave me the control that I was attempting to achieve using the manual approach. Needless to say, this resolved the issues I was encountering.

    Thanks for your help!


  • Tommy N.

    Are the child activities built in to the custom composite activity, i.e. when you compiled the custom composite, did it already have children Or are they added when you use the composite

    If it's the latter, then the Names must be unique in the workflow, as the composite they reside in is not a qualifying container for them, or is any other activity in the workflow. If the activities are built in though and you are essentially adding one activity in your dynamic update (the custom composite that has all the children built into it), then it seems there is some other issue.

    Thanks!



  • nstraub

    Angel,

    Here's more info that leads me to believe there could be a bug performing dynamic updates from the host...

    Within the workflow I can dynamically create three instances of my composite activity (each with a unique name) which runs to completion successfully. If I delete one of the composite activities from the host I get a validation exception (duplicate activity names) on the other two composite activities which were added successfully within the workflow.

    I will modify my composite activity to generate unique names for all of its child activities and see if that works.

    ~S2


  • engaref2000

    Hi Angel,

    The child activities are built into a SequentialActivity compiled in a separate assembly. When I add a task (SequentialActivity) to the workflow, I add an instance of the composite activity...

    Activity workflowDef = workflowInstance.GetWorkflowDefinition();

    WorkflowChanges changes = new WorkflowChanges(workflowDef);

    TaskActivity task = new TaskActivity();

    task.Name = "ReviewTask" + taskId.ToString();

    changes.TransientWorkflow.Activities.Insert(index, task);

    workflowInstance.ApplyWorkflowChanges(changes);

    When changes are applied, a validation exception is thrown with an error 1538 for each child activity.


  • Duplicate activity name error when dynamically adding a custom composite activity