Publishing is incomplete at the end of the workflow

Our final auto activity is publishing a component for a live target. We have some code written in Edit script.

' Script for Automatic Activity Content Manager Workflow

Set oTDSE = CreateObject("TDS.TDSE")
Call oTDSE.Initialize
Set oWorkItem = CurrentWorkItem.GetItem(3)
sDestinationServer = "tcm:0-18-65538"
Set oComp = oTDSE.GetObject(oWorkItem.ID, 3) 

Call oComp.Publish(sDestinationServer, True, True, True)

FinishActivity "Automatic Activity ""Process Complete"" Finished"

set oWorkItem = Nothing
set oComp = Nothing
set oTDSE = Nothing

      

This code runs successfully, but when we check that the publish queue component fails with an error tcm element: 34-20615-16-v0 does not exist.

The same code works fine when we publish the component to create in the previous activity.

+3


source to share


4 answers


The problem is that while in the script you publish the dynamic version (-v0) of the component. Since publishing is an asynchronous operation, the item is not immediately published, but a transactional publication is created (which references the dynamic version).

After that, your script will be executed and the element will get check-in. The publisher now starts processing your publish transaction and finds that the dynamic version is no longer there, so your exception.



When the activity is not published last, the publisher has enough time to get the dynamic version of the item.

The workaround could be to wait for the publish transaction to complete in your automatic activity, or do something with the OnCheckIn event

+1


source


Yes, this is a frequent one that I have encountered on site of clients. Especially when your last action in the workflow is automatic and "Publish to Live". The easiest way:

  • First FinishActivity in automatic code
  • Then publish workflow=false

    .


PublishCoreServiceClient.FinishActivity(activityInstance.Id, finishData, publishoptions);           
            }

 //Now Publish      
ComponentData component = (ComponentData)PublishCoreServiceClient.Read(componentid, publishoptions);
if (GetConfigurationValues(component, PublishCoreServiceClient))
{
    PublishInstructionData publishInstructionData = new PublishInstructionData();
    publishInstructionData.MaximumNumberOfRenderFailures = 100;
    publishInstructionData.RollbackOnFailure = true;

    ResolveInstructionData resolveInstructionData = new ResolveInstructionData();
    resolveInstructionData.IncludeWorkflow = false;
    resolveInstructionData.IncludeChildPublications = true;
    resolveInstructionData.IncludeComponentLinks = true;
    publishInstructionData.ResolveInstruction = resolveInstructionData;

    RenderInstructionData renderInstructionData = new RenderInstructionData();
    publishInstructionData.RenderInstruction = renderInstructionData;

    List<string> ItemToPublish = new List<string>();
    ItemToPublish.Add(component.Id);
    if (!String.IsNullOrEmpty(Utilities.LIVE_URI))
    {
        PublicationTargetData pubtarget = (PublicationTargetData)PublishCoreServiceClient.Read(Utilities.LIVE_URI, publishoptions);
        List<string> target = new List<string>();
        target.Add(pubtarget.Id);

        PublishCoreServiceClient.Publish(ItemToPublish.ToArray(), publishInstructionData, target.ToArray(), PublishPriority.Normal, publishoptions);
        Logger.Debug("ElapsedMilliseconds Publish [" + _watch.ElapsedMilliseconds + " ms]");

    }

      

+1


source


The issue was resolved by setting the activateWorkflow parameter of the Publish method to False.

0


source


We had the same error and we solved it by sending the component to publish with a delay of a few seconds:

Call oComp.Publish("tcm:0-1-65538", False, False, True, dateAdd("s",10,Now))

      

0


source







All Articles