Copied to clipboard

Flag this post as spam?

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


  • Maria Brick 2 posts 73 karma points
    Jan 17, 2022 @ 11:00
    Maria Brick
    1

    Save and publish without triggering new notification

    I have created a custom property editor. The property value needs to be updated after the page has been published and therefor I need to do a new SavAndPublish. This triggers new notifications which I try to cancel in the saving notification. I'm trying to create a condition which checks if our custom property has been edited by looking at if it is dirty or not. I can't get this to work properly which results in to many publishes even when the custom property hasn't changed at all.

    Previously there was a bool raiseEvents in the SaveAndPublish method which could be set to false. This bool isn't there anymore. The documentation still says: ContentPublishedNotification It can be skipped completely if the parameter "raiseEvents" is set to false during the Publish method call (true by default). Is it still possible to saveAndPublish without triggering a new Notification? If so how?

    How do I, in a notification, check if a specific property has been edited in order to perform certain actions on this property?

  • Malka Genzer 10 posts 82 karma points
    Jan 27, 2022 @ 14:26
    Malka Genzer
    0

    Hi, did you find a solution for this?

  • Maria Brick 2 posts 73 karma points
    Jan 27, 2022 @ 14:28
    Maria Brick
    0

    No, unfortunatly not.

  • Michael Argentini 5 posts 76 karma points
    1 week ago
    Michael Argentini
    1

    This is possible by wrapping the save call in a scope like this:

    using (var scope = StateService.ScopeProvider.CreateScope(autoComplete: true))
    {
        using (_ = scope.Notifications.Suppress())
        {
            ContentService.SaveAndPublish(item);
        }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft