Copied to clipboard

Flag this post as spam?

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


  • UPSB 9 posts 79 karma points
    Sep 23, 2019 @ 14:38
    UPSB
    0

    How do i correctly cancel saving event. Currently i do some property value checking in content and then i call e.CancelOperation("Error", "Error message", EventMessageType.Error). In back office i receive the error message for that content, but back office acts like content saved successfully and retains the new property value. It doesn't propt me then i leave content that i have unsaved changes. I can go to another content and then return to canceled saved content and the property value is the new one. I can open in new browser and go to canceled saved content and see the new value. Only if i restart the application then the property value is before the save.

  • Shaishav Karnani from digitallymedia.com 354 posts 1638 karma points
    Sep 23, 2019 @ 15:40
    Shaishav Karnani from digitallymedia.com
    0

    Hi,

    You need to use ResetDirtyProperties(). Cancel Event will not work here.

            foreach(var node in e.SavedEntities)
            {
                node.ResetDirtyProperties();
            }
    

    Also note this will only work when user save an event if user tries to Save& Publish then you need to write checking in both the areas.

    Hope this helps to solve your issue.

    Regards,

    Shaishav

  • UPSB 9 posts 79 karma points
    Sep 24, 2019 @ 06:39
    UPSB
    0

    Unfortunately it doesn't work. ResetDirtyProperties does nothing. I saw no difference running with it.

    But if content property had no value and some value was given and save canceled then it seams to work correctly. And it didn't matter if i used ResetDirtyProperties or not.

Please Sign in or register to post replies

Write your reply to:

Draft