5

I'm in the process of implementing Workflow, but am running into trouble with a particular template. Here's the test case:

  1. Created new image component – chimp2 – Save & Close
  2. Goto content Component
  3. Added chimp2 image to Component - Save & Close
  4. Go to workflow – “Finish activity” on Component. Component is published to preview.

Step 4 triggers a Component publish into a preview environment in Workflow using WorkItem.Publish("tcm:1-2-3", True, True, True), which as I understand it should publish the Workflow version of the Component.

However, when publishing against this DWT:

<img src="@@image@@" alt="@@Get('Fields.paragraphs[${TemplateRepeatIndex}].image.Metadata.description')@@" class="content-image @@image_alignment@@" />

I'm getting a rendering error from Get, which reads:

Expression 'Get("Fields.paragraphs[2].image.Metadata.description")' had error 'Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index"

But in the workflow version of the Component, the index exists.

Interestingly, if I rewrite the code to use DGX's GetFromItem:

<img src="@@image@@" alt="@@GetFromItem("${image}", "Metadata.description")@@" />

Then everything is found OK.

Is there a known issue or workaround in the Get extension when used within Workflow? I would prefer to update Workflow VB than troubleshoot 60 templates, given the choice!

1 Answer 1

2

As a workaround for this, I believe you can include the following lines of code:

PublishInstructionData publishInstruction = new PublishInstructionData(); publishInstruction.ResolveInstruction = new ResolveInstructionData(); publishInstruction.RenderInstruction = new RenderInstructionData();

//Needed for publishing workflow revision/version:

publishInstruction.ResolveInstruction.IncludeWorkflow = true;

Then when you do your publish, pass the publishInstruction. I.e.:

PublishTransactionData[] publishTransactions = SessionAwareCoreServiceClient.Publish(itemsToPublishList.ToArray(), publishInstruction, targets, PublishPriority.Normal, null);

1
  • 1
    Yup, I would think this solves it. Basically the current publish instruction doesn't tell Tridion to "use workflow version", while GetItem gets the latest version available to the current user (i.e., the one in workflow).
    – Nuno Linhares
    May 23, 2016 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.