Copied to clipboard

Flag this post as spam?

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


  • Robert 30 posts 149 karma points
    Feb 09, 2018 @ 16:29
    Robert
    0

    Replicating change in a document type instance throughout tree.

    We have a document type called "Service" with 2 properties, Id and Name.

    Service types can exist anywhere in the content tree, in the root or as a child of another document type.

    Using CMSImport we import our service data from Sql Server into the CMS so we may have a "service" of Id = 1000 in the root of the tree and as a child of another document type at any point in the content tree.

    For our business purposes a "service" with an Id of 1000 is the same service wherever it exists in the tree and it could exist at multiple places.

    Therefore we want that if a cms editor updates the name property of a service with id of 1000 at any point in the content tree then all the other service document types with id of 1000 elsewhere in the tree are updated as well.

    How can we achieve that? Internally as far as Umbraco is concerned these are all stored as separate objects...

  • Dan Diplo 1316 posts 4880 karma points MVP 2x c-trib
    Feb 09, 2018 @ 19:19
    Dan Diplo
    0

    I'd consider changing your architecture so you have just one instance of the same Service (in a repository List View) and then use a Content Picker to associate the service with multiple nodes.

    However, if that's not possible you'll need to look at two things:

    Firstly, you're going to need to use an event such as the Published event to hook into whenever a Service is updated. See:

    https://our.umbraco.org/documentation/Reference/Events/ContentService-Events

    Then you're going to need to use the Content Service to find all events with the Id of the one being published and then copy the values from the origin to each of them.

    See https://our.umbraco.org/documentation/Reference/Management/Services/ContentService

    That's the very short version, but hopefully points you in the right direction.

Please Sign in or register to post replies

Write your reply to:

Draft