v14 - ContentSavingNotification : How to force upd...
# help-with-umbraco
m
Has somebody been able/lucky to force an update of the property editors after a user has clicked "Save" and you have changed value of an property in the "saving" process. I have added this to the builder
builder.AddNotificationHandler<ContentSavingNotification, SavingNotification>()
And implemented it with
Copy code
public class SavingNotification() : INotificationHandler<ContentSavingNotification>
    {
        public void Handle(ContentSavingNotification notification)
        {
            // .. do stuf changing value of property
        }
    }
All is good - the value of the property is changed before save and is saved correct. BUT the user can not see the value has changed!! AND if the user clicks "save" again, the old values is send to the server. The user has to switch to another content node and back again or reload the page. Is it some way possible to set a value in the ContentSavingNotification that sends a message back to the backoffice that updates the properties or force a reload of the page.
Maybe @Jacob Overgaard has some knowledge of Umbraco magic 🙂
l
@Mikkel Johansen not sure if its an exact match, but I'm doing the following on a project On clicking save and publish, I have the following:
Copy code
public class SomeSavingHandler : INotificationHandler<ContentSavingNotification>
{
    public void Handle(ContentSavingNotification notification)
    {
        foreach (var item in notification.SavedEntities)
        {
            item.SetValue("someAlias", "some value");
        }
    }
}
Where my code seems to differ, I have another notification hander on the ContentPublishingNotification
Copy code
public class SomePublishingHandler : INotificationHandler<ContentPublishingNotification>
{
    public void Handle(ContentPublishingNotification notification)
    {
        foreach (var entity in notification.PublishedEntities)
        {
              entity.SetValue("anotherAlias", "anotherValue");
        }        
    }
}
We need the two seperate handlers for reasons specific to the project, unsure if it makes any difference, perhaps change your SavingNotification to a ContentPublishingNotification?
m
Don't think that solves my problem. The problem is that the backoffice do not show the real values of the properties after a save and actually the same thing after a publish. If you change the "name" of an existing content node and click "Save and publish" then the "link" on the "Info" section has not changed. The new link value will show the real/new value after a reload of the backoffice. It sounds like a bug issue has to be created.
l
Okay I see, we’re changing a bool property value, and when the save/publish has completed, it updates automatically, no need for a page refresh
m
9 Views