Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Andrew 8 posts 79 karma points
    Dec 04, 2019 @ 08:12

    Move a document type down one level

    Good morning,

    I wish to move a document type from the current level in the tree, down one level.

    My document type "Gallery" is currently sitting at:

    BaseDocumentType > BaseWebpage

    I wish to move it so it's parent is now StandardContent

    BaseDocumentType > BaseWebpage > StandardContent

    The problem is I have to do this on more than one server. I make the change on a local server, but then deploy to Staging and then to pre-prod after that.

    I am using uSync to control doctypes. Currently my method to get this to work is to export the Gallery doctype, delete the old doctype, edit the export file so that it contains the correct parent, then import the doctype into Umbraco again. However in the end this still Deletes the doctype in local, and a usync file is created that shows this. this means my content associated with this doctype is also deleted when I deploy this change to staging!

    Is there a nice hack you can use to trick uSync into simply moving a doctype?


  • Joep 75 posts 555 karma points
    Dec 04, 2019 @ 08:37

    You could make a SQL query that changes the parent of the "Gallery" document type.

    UDATE umbracoNode set parentID={StandardContent id} WHERE id = {Gallery id}

    EDIT: You need to remove the relation aswell:

    DELETE FROM csmContentType2ContentType WHERE childContentTypeId = {Gallery id}
  • Andrew 8 posts 79 karma points
    Dec 04, 2019 @ 18:56

    It definitely moved the document type, but none of the inherited fields are in it.

    So I guess I'm back to square one

  • Dmitriy 168 posts 586 karma points
    Dec 04, 2019 @ 09:02

    That is one of reasons I don't use inheritance in umbraco ducument types, there is no easy way to change an inheritance hierarchy.

    Consider interface orientied approach with document types in future, it much more flexible.

    I think, Joeps advise would solve your problem as it is, please tell us if it does

  • Andrew 8 posts 79 karma points
    Dec 04, 2019 @ 20:06

    Okay I got it to work:

    1) Export the Gallery doctype

    2) Edit the udf export file so that it contains the correct parent

    3) Rename the old doctype to something e.g. Gallery2

    4) Import the new doctype (udf) into Umbraco.

    5) Go into the parent doctype of the content you are trying to keep, and make sure the new doctype is associated as a permission. It should now have Gallery2 and Gallery as page types

    6) Right click the node and Change document type, it should change from Gallery2 to Gallery

    7) Commit & deploy to staging

    8) Do a uSync

    Magic, your content is still there!

    9) Clean up - delete Gallery2

  • Kelnmyir 1 post 71 karma points
    Aug 06, 2020 @ 10:37

    Hi everyone

    Good news from Umbraco 8 - this feature is fully achievable through uSync. Just export, edit some xml and import. Your doctype will be edited, without any changes in content.

    To change parent, you should edit these parts of Info section

    <Parent Key="PARENT_GUID_GOES_HERE">PageBase</Parent>
      <Composition Key="PARENT_GUID_GOES_HERE>PageBase</Composition>
Please Sign in or register to post replies

Write your reply to: