Copied to clipboard

Flag this post as spam?

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


  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Nov 02, 2011 @ 19:53
    Bo Damgaard Mortensen
    0

    Check if nodename has changed on after publish event

    Hi all,

    I'm in a situation where I need to check if the node name has been changed whenever a user publishes the node. So basically I have to get the node name as it was before the publish was initiated and see if it's any different than the node name after the document has been published.

    Has anyone done this before? :)

    Thanks in advance!

    All the best,

    Bo

  • Tom Fulton 2030 posts 4998 karma points c-trib
    Nov 02, 2011 @ 20:00
    Tom Fulton
    3

    Hi Bo,

    Just a thought but it might work:

    Get the current node name from the Document API

    Get the curent published node name from the NodeFactory.  (I think) on AfterPublish NodeFactory will still give you the old data, I think the cache doesn't get refreshed until a later event (AfterUpdateDocumentCache) - so you could compare with that.

    Just a thought :)

    -Tom

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Nov 02, 2011 @ 20:47
    Bo Damgaard Mortensen
    1

    You're a genious, Tom! Thank you so much :) It works like a charm.

    So the code I ended up using was:

    Node n = new Node(sender.Id);
    if (!sender.Text.Equals(n.Name))
    {
         Log.Add(LogTypes.Custom, sender.Id, "Before published event fired and the old name was: " + n.Name);
    }

    For future reference.

Please Sign in or register to post replies

Write your reply to:

Draft