Copied to clipboard

Flag this post as spam?

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


  • guldmand 2 posts 32 karma points
    Jul 02, 2020 @ 11:36
    guldmand
    0

    uSync content (umbraco pages) to different environment without changing page-id's (nodeId)

    Hello uSync / Kevin jump

    Through my work I have inherited an old website currently running Umbraco 7.4.3.

    With this old website I am trying to 'uSync' content specifically: Umbraco pages, from one environment to another environment, without changing pages page-ids (within the database the page-ids is called nodeId).

    Screenshot/example of a Umbraco 7.3.4 installation and its Umbraco pages shown from within the database: example of page_id's or nodeId's from within the database

    Environments:

    • local development
    • testing server
    • production server

    The reason i want/need to do this, is that the website has a custom build order flow with multiple steps where a custom controller is placing the customer on a specific (hardcoded) page_id based on the completion of the previous step.

    And now i need to add another step (add another page in the flow). I am hoping that I can accomplish this sync of content and keeping page-ids, with uSync so i don’t manually have to overwrite the different environments databases, to get Umbraco pages and their page_ids intact across all our environments.

    Current nuget-packages installed:

    • UmbracoCms -Version 7.3.4
    • uSync -Version 3.0.4.1

    I tried to install the following new nuge packagest:

    • uSync.ContentEdition -Version 3.0.0-rc3
    • uSync.BackOffice -Version 3.0.0-rc3

    But when i now runs uSync export the content (pages) from one environment, and then import on another environment, the result is that the environment running the import will import the pages successfully, but a unwanted side effect of this successfull usync import is that the page-id is changed, which ends up being a problem for the hardcoded page_ids within our flow controller.

    Example of the flow-controllers hardcoded (page_id) navigation:

            if (step-x-completed)
            {
                // send to page(page_id)
                return RedirectToUmbracoPage(1049);
            }
    

    I also tried to install the following nuget:

    • uSync.ContentMappers -Version 3.2.0

    But this made no changes and the page-ids is still changed upon successful uSync import.

    I noticed that exported pages, imported in a different environment keeps their guid intact, but should uSync not leave the page-id (nodeId) intact/without changes??

    Is there a clever way I can customize my uSync settings in this "old setup", so that it will uSync the content across environments but at the same time leaves page_ids (nodeId's) intact and without changes ?

  • Kevin Jump 1753 posts 11263 karma points MVP 4x c-trib
    Jul 02, 2020 @ 11:49
    Kevin Jump
    100

    Hi

    yeah the page ids will change - uSync isn't keeping the page ids the same (it can't really they are DB Keys, so without DB hacking they are going to change when you add new items)

    Instead uSync is updating the references to those Ids acorss all Umbraco elements, so for example where a peice of content refrences another content item by id, uSync updates it, the template Ids change and uSync updates them too.

    What it can't do is update those values in code, so if you have hardwired Ids inside templates etc, then its going to break, the recommendation is to not do that (i am sure you know) -

    If was doing a quick and dirty i would move the ids out to the web.config so you can update them and use ConfigurationManager.AppSettings["keyname"] to get them. If i was being less dirty i would have a settings page inside Umbraco with pickers for each one, then you find that settings page (e.g with xpath //settings) and read the Id values in. but i suspect its not going to be a pritty task ☹

  • guldmand 2 posts 32 karma points
    Jul 02, 2020 @ 13:13
    guldmand
    0

    Thanks a lot for the super fast and informative reply Kevin!!!!

    Even though your answer is not the answer I was hoping for, I'm glad for the insight and clarification your answer gave me. And also thank you for pointing me towards the two possible solutions mentioned!

    I think that the "quick and dirty" solution you mentioned with moving the ids into web.config is the fastest way to accomplish "adding the new Umbraco page to the flow" at this point.

    In the long run I do 100% agree that the hardwired ids is horrible/bad practice, and I plan on re-code the entire website without hardwired ids ASAP with either Umbraco8 or perhaps "Umbraco Heartcore".

    Keep up the good work with uSync, and again thanks for your guidance - it helped me a lot :) !

Please Sign in or register to post replies

Write your reply to:

Draft