Copied to clipboard

Flag this post as spam?

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


  • Jannik Nilsson 38 posts 81 karma points
    Aug 20, 2009 @ 12:00
    Jannik Nilsson
    0

    Change Master Document Type after creation

    Is it possible to set the Master Document Type of a Document Type after creation?

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Aug 20, 2009 @ 12:10
    Thomas Höhler
    102

    Only in the database: in tha table cmsContentType you can edit the column MasterContentType

    Thomas

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Aug 20, 2009 @ 12:11
    Thomas Höhler
    0

    Forgot to say: You put in the nodeId from the ContentType you want as master

  • dandrayne 1138 posts 2262 karma points
    Aug 20, 2009 @ 12:11
    dandrayne
    0

    I dont think so, no.  It's important to "map out" (either mentally or whatever) the structure and data types needed for a site running umbraco, as this can't really be changed.

    I'm ready to be corrected though, it would have helped on a few occasions!

    Dan

  • Johan Roug 97 posts 153 karma points
    Sep 01, 2009 @ 23:33
    Johan Roug
    3

    A smart way to change the default documenttmaster is to rightclick on the node in the contenttree, fx (blog), and choose "copy". THen choose the new location, and choose a documentmaster.

    Afterwards you might need to do some trimming, but I have found this the only way to solve the problem.. and yes I have tried with "block for umbraco", and it works perfectly after this operation :)

  • Rob Watkins 369 posts 701 karma points
    Dec 19, 2017 @ 10:42
    Rob Watkins
    0

    Wow, 8 years later, Umbraco 7.7 and this tip STILL works and has saved me having to recreate a billion properties, thanks from the future Johan :)

  • Rik Helsen 670 posts 873 karma points
    Oct 12, 2011 @ 11:55
    Rik Helsen
    0

    Awesome tip Johan!

  • Dan Diplo 1554 posts 6205 karma points MVP 5x c-trib
    Oct 12, 2011 @ 14:09
    Dan Diplo
    0

    The best solution, of course, would be if Umbraco actually allowed you to change the Master DocType via the existing interface. I've raised this as a feature request on Codeplex - it's the highest voted issue that still hasn't been resolved. Please vote for it if you want a change.

  • ravindranathw 14 posts 50 karma points
    Sep 26, 2013 @ 12:42
    ravindranathw
    0

    Better way would be backup the data in the content area and then export the documentType to UTD file. Then Delete the documentType import it back by right clicking root documentType. When importing select master document type.

  • ravindranathw 14 posts 50 karma points
    Sep 26, 2013 @ 12:43
    ravindranathw
    0

    Oh forgot to tell. Change the MasterDocumentType in xml file(utd) you can do this by editing using a txt file

  • Carlos Casalicchio 170 posts 709 karma points
    Jan 13, 2014 @ 13:05
    Carlos Casalicchio
    0

    For umbraco 6+ I've used the following sql query to change the Parent Document Type

    UPDATE umbracoNode SET parentID = <<parent id>> WHERE id = <<id>>
    

    There's no way to change the Parent Document Type in the Umbraco Dashboard, only via SQL (use it at your own risk!)

  • Thomas Egebrand Gram 63 posts 138 karma points
    Jan 22, 2014 @ 16:01
    Thomas Egebrand Gram
    0

    Carlos' solution did the trick for Umbraco 6. Thank you very much! :-)

    // Thomas 

  • David Court 6 posts 26 karma points
    Feb 25, 2014 @ 12:02
    David Court
    0

    Couldn't get any of the above solutions to work on umbraco 6.1.6 but this did:

    UPDATE umbracoNode SET parentID = {Parent ID} WHERE id = {Content Type ID}

    UPDATE cmsContentType2ContentType SET parentContentTypeId = {Parent ID} WHERE childContentTypeId = {Content Type ID}

    However it seems to cause an issue with adding custom tabs (i.e. it doesn't), any further solutions to that anyone?

  • Davey Bonamie 5 posts 26 karma points
    Mar 24, 2014 @ 10:18
    Davey Bonamie
    1

    I have used this query to put document types without a master under another master document type. It was build up by posts of other topics here.

    USE WebsiteDB;  -- Set with your DB name
    GO

    DECLARE @ContentTypeId INT, @NewParentId INT;
    SET @ContentTypeId = 1058;  -- set with ID of ContentType to change
    SET @NewParentId = 3114;    -- set with ID of new parent to set to @ContentTypeId

    -- Set new ParentID
    UPDATE [cmsContentType2ContentType]
    SET [parentContentTypeId] = @NewParentId
    WHERE [childContentTypeId] = @ContentTypeId;

    -- Remove GroupID from properties that are in inherits groups
    UPDATE cmsPropertyType
    SET propertyTypeGroupId = NULL
    FROM cmsPropertyType
        INNER JOIN cmsPropertyTypeGroup ON cmsPropertyType.propertyTypeGroupId = cmsPropertyTypeGroup.id
    WHERE (cmsPropertyType.contentTypeId = @ContentTypeId) AND (cmsPropertyTypeGroup.parentGroupId IS NOT NULL);

    -- Remove inherits groups
    DELETE TB1
    FROM cmsPropertyTypeGroup TB1
    WHERE (TB1.contenttypeNodeId = @ContentTypeId) AND (TB1.parentGroupId IS NOT NULL);

    -- Reading path info
    DECLARE @NewParentPath VARCHAR(100);
    SELECT @NewParentPath = [path] FROM umbracoNode WHERE id = @NewParentId;

    -- Update Path field
    UPDATE umbracoNode
    SET parentId = @NewParentId
        , [path] = @NewParentPath + ',' + CAST(id AS VARCHAR(20))
    WHERE id = @ContentTypeId;

    Insert into cmsContentType2ContentType Values(@NewParentId,@ContentTypeId)

    GO

    Afterwards I do a IIS restart and it's working fine.

     

  • David Court 6 posts 26 karma points
    Apr 01, 2014 @ 16:08
    David Court
    0

    Thanks for sharing, I'll try that out

  • Matt Taylor 873 posts 2086 karma points
    Jan 22, 2015 @ 15:43
    Matt Taylor
    0

    The scripts appears to work OK in Umbraco 7 too.

Please Sign in or register to post replies

Write your reply to:

Draft