Copied to clipboard

Flag this post as spam?

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

  • andy_rose 91 posts 117 karma points
    Aug 02, 2011 @ 16:07

    Can I get the before and after values of a property during a documents save event?

    I'm not sure if this is possible but when I hook into a document's save event can I easily get the before and after properties throught the api? I would guess that this would involve the versioning aspect of Umbraco; I was hoping someone may have already tackled this and give some insight into how best go about it.

  • Richard Soeteman 3709 posts 11482 karma points MVP
    Aug 03, 2011 @ 07:43
    Richard Soeteman


    You might want top read this blogpost which is telling that it should work since Umbraco 4.6.I haven't tried this myself since I always thought it wouldn't work because properties get saved immediatelyafter they got a value assigned.

    Hope this helps you,


  • andy_rose 91 posts 117 karma points
    Aug 03, 2011 @ 10:35

    Thanks for the link Richard, the solution I came up with in the end was to hook into the Document.BeforeSave event, retrieve the property value I was after and store it in Session so that I could access it from the Document.AfterPublish event and this does appear to be working as expected. During the BeforeSave event the property value is the original value and in the AfterPublish event it is the saved value which allows me to make the comparison.

    Overall it seems a little heavy handed but I guess that is just how Umbraco works and it achieves the desired result.

Please Sign in or register to post replies

Write your reply to: