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 12 posts 84 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 78 karma points
    May 11, 2022 @ 21:09
    Michael Argentini
    3

    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);
        }
    }
    
  • Malka Genzer 12 posts 84 karma points
    May 30, 2022 @ 10:10
    Malka Genzer
    0

    Thanks Michael!

  • LandLogic IT 3 posts 24 karma points
    Jun 05, 2023 @ 18:05
    LandLogic IT
    1

    For Umbraco 11.x and 10.x:

    using var scope = _coreScopeProvider.CreateCoreScope(autoComplete:true);
                        {
                            using (_ = scope.Notifications.Suppress())
                            {
                                _contentService.SaveAndPublish(item);
                            }
                        }
    
  • Jay 415 posts 641 karma points
    12 hours ago
    Jay
    0

    Tried that in V13 but it doesn't seem to work. The Content History stills gets added every time when a SaveAndPublish is triggered in that code too

  • Jay 415 posts 641 karma points
    7 days ago
    Jay
    0

    Does it prevent it from adding into the Content history for the publishing?

Please Sign in or register to post replies

Write your reply to:

Draft