Copied to clipboard

Flag this post as spam?

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


  • David Vainer 15 posts 96 karma points
    Oct 18, 2023 @ 12:14
    David Vainer
    0

    GetDirtyProperties() and IsPropertyDirty() methods do not work as expected

    When some content node is saved in Umbraco, I want to catch the ContentService.Saving event and append the next logic:

    1. Check if at least one property from a list of properties I defined in advance, is dirty (the value changed during the save).
    2. If there are any, do something like logging.

    In order to achieve the behavior of the first point, I'm trying to use Umbraco's GetDirtyProperties() or IsPropertyDirty() methods, to check which properties are dirty or now.
    The problem is that even without making any changes, some properties are marked as dirty, even though their values weren't changed at all!

    From what I noticed, those problematic properties are especially empty textstrings / multinode pickers data typed properties (and maybe there are more types which I didn't noticed).
    I've found this bug that may be related, however no one addressed it - https://github.com/umbraco/Umbraco-CMS/issues/11683.

    This problem is crucial for me and prevents me from achieving the logic I need for my system requierments.
    Is there something I can do? Any workaround?

    Umbraco version - 8.2.2

Please Sign in or register to post replies

Write your reply to:

Draft