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?
using var scope = _coreScopeProvider.CreateCoreScope(autoComplete:true);
{
using (_ = scope.Notifications.Suppress())
{
_contentService.SaveAndPublish(item);
}
}
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?
Hi, did you find a solution for this?
No, unfortunatly not.
This is possible by wrapping the save call in a scope like this:
Thanks Michael!
For Umbraco 11.x and 10.x:
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
Does it prevent it from adding into the Content history for the publishing?
is working on a reply...