Copied to clipboard

Flag this post as spam?

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


  • Mathew Knott 6 posts 49 karma points
    Mar 25, 2019 @ 14:36
    Mathew Knott
    0

    Change Document Type in Umbraco 8

    I've noticed in Umbraco 8 there is no option to "Change Document Type" when editing a page in the tree (Under the menu Do Something Else).

    Does anyone know if this feature will come back or if it's gone for good or if kind of work is recommended now to be handled in a different way.

    It was a very handy and useful feature.

  • Bjarne Fyrstenborg 1280 posts 3990 karma points MVP 7x c-trib
    Mar 25, 2019 @ 14:50
    Bjarne Fyrstenborg
    0

    Hi Mathew

    It seems the action exists here, but has been commented out for now: https://github.com/umbraco/Umbraco-CMS/blob/dev-v8/src/Umbraco.Web/Actions/ActionChangeDocType.cs

    I guess it is because the old one was using WebForms and it needs to be re-written with Angular + Web API in Umbraco 8.

    The other actions have Angular views and controllers, which exits here: https://github.com/umbraco/Umbraco-CMS/tree/91c52cffc8b7c70dc956f6c6610460be2d1adc51/src/Umbraco.Web.UI.Client/src/views/content

    It would be great if you submit an issue here: https://github.com/umbraco/Umbraco-CMS/issues

    /Bjarne

  • Mathew Knott 6 posts 49 karma points
    Mar 25, 2019 @ 14:58
    Mathew Knott
    0

    Thanks for looking into it. I'll create the issue.

  • Mathew Knott 6 posts 49 karma points
    Apr 02, 2019 @ 00:22
    Mathew Knott
    103

    FYI, this was further discussed here..

    https://github.com/umbraco/Umbraco-CMS/issues/5070

    Unfortunately, it has been decided that this feature is in the too hard basket for the moment to be implemented. The reason given - the new implementation of multilingual content and the way that is treated is different to V7 and the code can't be just copied across.

    Disappointing as this was a very useful feature in Umbraco 7. Hopefully they'll have the capacity to implement in future versions.

  • Alan Mitchell 57 posts 279 karma points c-trib
    Jun 24, 2021 @ 19:52
    Alan Mitchell
    1

    Appreciate I'm very late to the party. But if anyone else googles their way here, I found it relatively easily to script the database to migrate some content from one document type to a new version.

    Basically I copied the existing document type to a new version. Then used SQL to reassign all the content nodes I wanted to migrate from the old document type id to the new one.

    After this I altered the new document type, leaving alone any properties containing content I wanted to keep. So this only works for "narrowing a type. I wanted to go from a generic "page" type, retaining the main grid content, to something more specific - with different templates and permissions.

    I also had to rerun the migration script on the Umbraco Cloud databases after deployment.

    I've written some more complete instructions here: https://this.isfluent.com/blog/2021/changing-document-types-in-umbraco-8

  • Markus Rytterkull 25 posts 116 karma points
    Aug 23, 2021 @ 12:17
    Markus Rytterkull
    1

    Alan, You're a life saver :-)

    I have a customer that has imported 8000 pages from another CMS and afterwards we found out that some page types where not correct. So instead of creating about 200 new nodes and moving all children, which would take forever, I used your instructions and scripts. Works like a charm!

    Huge thanks :-) / Markus

  • Colin Wiseman 47 posts 178 karma points
    1 week ago
    Colin Wiseman
    0

    Unfortunately this doesn't work in U13 and most likely all versions back to 9. It does change the document type but all content is lost as the content is associated to a property id that is not in the new template.

    Did you find there was any content loss when you did this in 8, unless Umbraco fundamentally changed the property structure after, I would be very cautious with this approach.

    Thankfully I did follow your instructions with a db backup first, so no real harm :D

  • Alan Mitchell 57 posts 279 karma points c-trib
    1 week ago
    Alan Mitchell
    1

    Agreed, this approach won't work for anything using the Block Grid or Block List content (as you need to untangle the json containing property ids) , and probably not for anything multilingual. But the instructions are clearly labelled for Umbraco 8.

    For modern versions I'd recommend exploring Usync Migration, or even using Usync Content to serialise content, script changes to the files and then Reimport..

  • Colin Wiseman 47 posts 178 karma points
    1 week ago
    Colin Wiseman
    1

    Oh absolutely is marked for U8, but like any good developer stuck trying to find a solution I tried it, it didn't work, so I thought I'd say so others don't try it 👍🙂

    All the content I lost was in standard properties and not any nested content or block list, but as I said, I had a back up and all is good in the world.

  • Colin Wiseman 47 posts 178 karma points
    1 week ago
    Colin Wiseman
    0

    Although, it looks like if you employ tabs in U8 you will get content loss as each tab on a document type has a unique Id, and that tab hosts the properties. So changing a document type would mean those unique Ids get misaligned - I just tried this on a staging site for my client and everything that was in the "generic" tab was fine and data wasn't lost but the Test tab that we had created, content in the properties was lost.

    I bet there would be a way to write a script in sql to manage that some how. However I am poop with Sql so I will default back to writing it in c# land :D

  • Colin Wiseman 47 posts 178 karma points
    1 week ago
    Colin Wiseman
    0

    Being that the Umbraco code doesn't allow you to programmatically change the content type, I bet your Sql could be employed as the same time c# - write an end point, pull out all the content you want updated, clone it and hold it in memory, Sleep() for a few minutes while you hit the old Sql change-a-roo, and then update all the nodes via something like this:

    content.SetProperty("", clone.GetValue<string>(""));
    content.TemplateId = 1234; // cause you most likely will have changed the template.
    _contentService.SaveAndPublish(content);
    

    Oh, that might work nicely and it's not uSync (sorry... too many bad nights with uSync 😔)

    I now ramble. It's been a massive 2 weeks with content importing and now they want all the news items with their own doctype.

  • Marc Goodson 2133 posts 14273 karma points MVP 8x c-trib
    1 week ago
    Marc Goodson
    2

    Hi Colin

    Did you have a look at Flip?

    https://www.nuget.org/packages/Flip.Umbraco/13.0.0

    Have had some success for using it to allow editors to change page content types...

    ... If its a block or nested item that has to change, then you can do it with SQL, but uSyncMigrations allows you to write a specific migration plan, to apply the changes to usync settings and content files that if all looks good, can then be imported back in to apply the changes... Have done a few nested content to block list Migrations and olg grid to block grid, which have worked out well...

    Regards

    Marc

  • Colin Wiseman 47 posts 178 karma points
    1 week ago
    Colin Wiseman
    0

    I haven't seen that before and I like th story written there.

    Thankfully my use case can be done with a bit of c# and a bit of SQL together after copying document types. It's easy enough to duplicate values and none of the news or blog items have associated child nodes so duplicate, delete, save and publish and I am golden.

    But this might help in the future when we move our massive client to 13 - they have mor document types than you can shake a stick at and there is so no need for it 🤣

  • Fiona Garnet-Lawson 26 posts 137 karma points
    Aug 26, 2021 @ 09:46
    Fiona Garnet-Lawson
    1

    Would echo that that the feature 'Change Document Type' is really useful, and it would be nice to have it back.

    Since there is no further development on v8, is this functionally on the 'to do' list for v9?

    thanks Fiona

  • Chris Ashton 57 posts 89 karma points
    Aug 28, 2021 @ 21:05
    Chris Ashton
    1

    @Fiona Killer feature for me in v7... several enterprise clients won't upgrade to v8 because of the reduced agility v8 introduced by removing this feature.

  • Jamie Attwood 201 posts 493 karma points c-trib
    Oct 18, 2021 @ 19:28
    Jamie Attwood
    0

    This needs to get back on the list for V9 for sure. This is a feature mostly used when upgrading sites from v7 upwards!

  • Chris Mahoney 234 posts 446 karma points
    Nov 17, 2022 @ 00:40
    Chris Mahoney
    0

    I'm guessing this didn't make it into 9 either... because I've just upgraded a site from 7 to 10.3 and the option's not there. Has there been any progress on this?

Please Sign in or register to post replies

Write your reply to:

Draft