Tridion BCopy- Copy a Tridion Blueprint Item

February 8th, 2012 | Posted by Robert Curlette in Tridion

Tridion provides great Blueprint functionality allowing us to share and localize content across many locales and Publications.  Sometimes we want to make a copy of an item – the whole item with all of its’ Blueprint-children, and then maybe change some metadata with the new item and nothing else. However, the copy button in Tridion only copies the current item –  and not its’ associated Blueprint-children.

Tridion BCopy – When A copy is not enough

Tridion BCopy copies the item (Component, Page, Structure Group, or Folder) and all of its’ Blueprint-children, including associated metadata, etc.  When copying a Folder or Structure Group it does not copy the contents of it – only the item itself.


Copy item with Blueprint children
The code is written in classic ASP – yes, I hear you moaning or cheering, but rest assured this approach works on all versions of Tridion up to Tridion 2011 and is quick to deploy and start using right away.  I tested the code on Tridion version 5.3 and it works great.

Getting Localized Items

The most interesting part of the code is getting the localized items.  This approach uses the GetListUsingItems and a special RowFilter condition.  You might want to use the same code to process localized items for updates, etc, and I have used it many times.

Function GetLocalizedItemNodes(itemUri)
    Dim tridionItem : set tridionItem = tdse.GetObject(itemUri,1)
    Dim rowFilter : set rowFilter = tdse.CreateListRowFilter()
    call rowFilter.SetCondition("ItemType", GetItemType(itemUri))
    call rowFilter.SetCondition("InclLocalCopies", true)
    Dim usingItemsXml : usingItemsXml = tridionItem.Info.GetListUsingItems(1919, rowFilter)
    Dim domDoc : set domDoc = GetNewDOMDocument()
    Dim nodeList : set nodeList = domDoc.SelectNodes("/tcm:ListUsingItems/tcm:Item[@CommentToken='LocalCopy']")
    set tridionItem = nothing
    set domDoc = nothing
    set GetLocalizedItemNodes = nodeList
End Function

Updating content

We use the GetXML method to get the contents of the item.

GetLocalizedXml = localizedItem.GetXml(1919)

When updating, we use the UpdateXml method of an item to save the original contents to the copy. This is the best and fastest way to update Tridion content.



I use Twitter Bootstrap version 1.0 for all custom pages.  If you have not checked this out – you need to.  No need to write your own CSS for custom pages anymore!  Use the Bootstrap HTML / CSS and have nice looking custom pages in no time.


Get the code
View the full code on GitHub at TridionBCopy or download the zip.

Upload to server
Copy to the Tridion/Web/CustomPages folder on your server or wherever you put your asp custom pages.

Use it
Create a link to it in the Custom Pages tree menu and save time with it!

You can follow any responses to this entry through the RSS 2.0 You can leave a response, or trackback.

2 Responses

  • Hendrik Beenker says:

    Hi robert,
    Good concept! I am trying to understand thought what exactly is copied.
    I copy a folder to another location in the blueprint structure and it will copy all components and folders along with it, including any localized items in child publications?
    Maybe you could show it with a quick Youtube video?


  • robert curlette says:

    Thanks Hendrik. Currently the script copies the item and all of the related localized child items. For example, if I have an article in the parent level in English, and then localize it in 30 child Publications, and use the default copy button of Tridion, it will copy only the parent and not the 30 localized items. This custom page also copies all 30 child items as well. Often I see editors wanting to make a new version of something (including children), but only change a few fields.

Leave a Reply

Your email address will not be published. Required fields are marked *