Here is the scenario: I have a page that has component A. Component A has several related components B and C. If the editor modifies component B and wants to publish it to an intermediate target while the component is still in the workflow, so the reviewer can view the changes on the intermediate server before approving component B. When the editor preview component can see the changes, but when it publishes to the intermediate target, it will capture the latest tested version of Component A, to Thoraya still associated with an unmodified version of the component B. As a pragmatic overwrite the default behavior to allow the editor to publish his changes in staging environment to complete the action for an item?
In addition, when component B is inserted directly on the second page, I was able to publish from VBScript from an automated workflow activity using the following:
Dim strItemURI strItemURI = CurrentWorkItem.GetItem(2).ID Dim oComp Set oComp = TDSE.GetObject(strItemURI, 1) Call oComp.Publish("tcm:0-13-65537", True, True, False) Set oComp = Nothing
FinishActivity Automated Activity Publish to Finish
Do I need to write a custom resolver to execute the above script to allow a modified version of the related components published in the staging environment during the workflow?
Any idea or samples will be appreciated.
Thanks.
Updated:
I am trying to create a TBB that will replace a modified version of an element in a package. Any ideas on this? Here is the code:
public void Transform(Engine engine, Package package) { try { _publicationID = engine.PublishingContext.ResolvedItem.Item.Id.PublicationId; string stagingTarget = Settings.GetSetting("StagingTargetUri"); PublicationTarget target = new PublicationTarget(new TcmUri(stagingTarget), engine.GetSession()); if(engine.PublishingContext.ResolvedItem.PublicationTarget!=null){ if (stagingTarget.Contains(engine.PublishingContext.ResolvedItem.PublicationTarget.Id.ToString())) { foreach (Item item in package.GetAllByType(ContentType.Component)) { VersionedItem versionedItem = (VersionedItem)engine.GetObject(item); if (versionedItem.LockType.HasFlag(LockType.InWorkflow)) { Component componentInWorkflow = (Component)engine.GetObject(new TcmUri(versionedItem.Id.ItemId, versionedItem.Id.ItemType, versionedItem.Id.PublicationId, 0)); package.Remove(item); Item mainComponent= package.CreateTridionItem(ContentType.Component,componentInWorkflow); package.PushItem(mainComponent); } } } } } catch (Exception ex) { throw ex; } }
source share