Copied to clipboard

Flag this post as spam?

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


  • mike 90 posts 258 karma points
    Mar 06, 2015 @ 17:49
    mike
    0

    Re-arranging DocumentType Loses Data

    I realised I needed to re-arrange my document type due to certain properties I only want inherited by certain documents.

    As there is no feature to do this I followed this process:

    1. Export document type.
    2. Delete document type
    3. Edit export file and tag.
    4. Re-import the file

    This generates an object reference not found exception in the admin panel and any document of that type is deleted from the CMS completely.  

    I think this is happening because by deleting the document type it no longer appears on the list of allowed child nodes for the documents parent and has o be re-set after import.  However thats too late as the data has gone by that point and setting it doesnt bring it back.

    So I guess I need to follow something like this:

    1. Copy document type to location you want under a different name
    2. Change all documents document type to copy type
    3. Change parent to allow document type copy child items
    4. Delete original docuement type
    5. Copy the copy to same location with the original name
    6. Change parent to allow original document type again
    7. Change all documents document type back to original
    8. Delete first copy

    Is there a better way to handle it?

  • mike 90 posts 258 karma points
    Mar 06, 2015 @ 20:20
    mike
    0

    OK, tried the long ass method and it still doesnt work, I'm getting the object not found error on front end now.

    From what I gather umbraco adds parent document types as an interface so why is it so hard to move them?

    Error I am getting looking for link in admin is:

    "Oops: this document is published but is not in the cache (internal error)"

    How do I fix this?  

    EDIT:

    Republish entire site fixes it but still, surely there is an easier way to move document types?

  • mike 90 posts 258 karma points
    Mar 06, 2015 @ 20:54
    mike
    0

    I did a test updating the "cmsContentType2ContentType" table to move a document type.  And it worked! No cache errors or anything, it just worked.

    If it is this easy why can't it be done in admin?  I have a horrible feeling its not that simple and will run into problems down the line :S

  • mike 90 posts 258 karma points
    Mar 06, 2015 @ 21:17
    mike
    0

    Trying to delete one of the document types I copied via admin is now generating this error:

    Failed to delete item 1121

    The DELETE statement conflicted with the REFERENCE constraint "FK_cmsPropertyData_cmsPropertyType_id".

    Not sure if this is just a Umbraco bug as I havent changed this document type in the database or a knock on effect of me updating a different doc type in the database.

    EDIT:

    I deleted all the properties off of the item and then it let me delete it.

  • mike 90 posts 258 karma points
    Mar 06, 2015 @ 21:33
    mike
    0

    This is a pain in the arse!

    I started re-arranging the document types and for no reason one of the ones I already moved jumped back to its original position.  The value is still changed so its got a different parentContentTypeId but it just magically moved back in the admin.  I tried clearing browser cache and rebuilding site cache but to no avail.

    The document type that jumped back however is still inheriting the properties from its new intended parent so I guess the issue is elsewhere.  Maybe I have messed up a sort order somewhere?

    I guess I'll answer myself in a few hours if I don't give up and get drunk.

  • mike 90 posts 258 karma points
    Mar 06, 2015 @ 21:56
    mike
    0

    To finish it off I had to update these fields in the umbracoNode table:

    ParentID
    Level
    Path
    SortOrder 

    It now appears to be working fine. I really cannot understand why this is not a feature of the admin.  Looking at other peoples projects I can see people use inheritence really sparingly (I guess this is why).  I wonder if there is a better way to define shared properties?  

  • mike 90 posts 258 karma points
    Mar 07, 2015 @ 00:06
    mike
    0

    Turns out managing this from umbraco services via code is much easier and also opened me up to the idea of using IContentTypeComposition so I can have complete control over which intefaces a doc type implements.  Shame the admin does not support it though as it means I'll have to code my own system for managing it.  

    Every time I think I am making progress with umbraco I turn a corner and another mountain of work rears its ugly head.  Definitely a love/hate relationship at the moment.

Please Sign in or register to post replies

Write your reply to:

Draft