Copied to clipboard

Flag this post as spam?

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


  • Susanne 7 posts 29 karma points
    Nov 26, 2015 @ 05:45
    Susanne
    0

    Saving content through ContentService wipes custom Property Editor JSON values in umbraco.config cache

    I have a console app that uses ContentService to save content programatically, but it seems to wipe the model value for custom Property Editors that have a JSON valueType.

    What this means is that when the umbraco.config cache is rebuilt after my console app runs all property values that would have been saved with a JSON value (if the content was saved via the backoffice) is actually saved with no value, even if no changes are made to any property values on the content at all before saving.

    What is strange is that the JSON is still available and stored in the database, it just appears that ContentService.Save() fails to recognise that the Property Editor is actually a custom one and does not fetch the actual value from the database. Saving the content through the backoffice will repopulate the property value in umbraco.config to the currently stored value in the database.

    I'm not sure what part of my code I can show to help get around this problem. My package.manifest is set up like so:

    {   
        propertyEditors: [      
            {
                alias: "MediaWithLinkAndTextstring",
                name: "Media with Link and Textstring",
                editor: {
                    view: "~/App_Plugins/Partial_MediaWithLinkAndTextstring/partialMediaWithLinkAndTextstring.html",
                    valueType: "JSON"
                }
            }
        ],
        javascript: [
            "~/App_Plugins/Partial_MediaWithLinkAndTextstring/partialMediaWithLinkAndTextstring.controller.js"
        ],
        css: [
            "~/App_Plugins/Partial_MediaWithLinkAndTextstring/partialMediaWithLinkAndTextstring.css"
        ]
    }
    

    Has anyone run into something similar? This is not ideal as it means every time a content page is updated programatically someone will need to manually load up the content in the backoffice and save it from there.

Please Sign in or register to post replies

Write your reply to:

Draft