Search code examples
tridiontridion-2011

Is it possible to publish component revisions within workflow?


Our current setup is that we have two targets, Staging and Live. Collaborators may update the affected component while it is still within the workflow. A final activity is set to publish the related pages to Live. Is it possible to publish component updates (revisions e.g. 2.2, 2.5) to Staging from within the workflow?

The TOM API documentation for Page.Publish() method does not seem to have an input parameter to fullfil such purpose.

EDIT: Additional details to our current setup: The page we're trying to publish has a "custom renderer", so to speak. The page template is setup to pull components from a certain folder recursively and build the HTML accordingly. The method used is Folder.GetItems(OrganizationalItemItemsFilter). It retrieves the list of components together with their data. The page doesn't have component presentations.


Solution

  • For standard Tridion solutions i.e. using Page+ComponentPresentations+Workflow, this will suffice:

    Setting activateWorkflow parameter to True in the Publish() method will publish the workflow revision. It's the 3rd parameter:

    Public Function Publish( ByVal targets As Variant,
                ByVal activateBlueprinting As Boolean,
                ByVal activateWorkflow As Boolean,
                ByVal rollbackOnFailure As Boolean,
                Optional ByVal publishTime As Date = 0,
                Optional ByVal unpublishTime As Date = 0,
                Optional ByVal deployTime As Date = 0,
                Optional ByVal resolveComponentLinks As Boolean = True,
                Optional ByVal priority As TDSDefines.EnumPublishPriority = Normal,
                Optional ByVal ignoreRenderFailures As Boolean = False,
                Optional ByVal maximumRenderFailures As Long = 0 ) As String
    

    Reference: TOM API Documentation: "activateWorkflow | Indicates whether the item is being (un-/re-)published from the user's work list."


    However, if customized renderers are used to build page output, like when using Folder.GetItems() to retrieve components in templates, additional calls would be required to actually retrieve the latest revision of components such as the version-zero -v0 trick by Nuno.

    Please note that if you decide to do this, the latest revision will always be published to your targets and it may not exactly be "approved" content.