I'm registering against the Document.BeforePublish Umbraco event handler, so that my application can strip out spatial data (Which is held in Umbraco serialized to XML).
When new spatial data is detected it's added to a seperate table in the database which is designed to hold spatial data in a format it can be searched/manipulated using the SQL Server 2008 spatial tools.
The long and short of this is that when an Umbraco document containing spatial data is published, the spatial data is inserted into another table and then the id of the newly inserted spatial data is added back into the Umbraco document.
This works - I can see from looking at umbraco.config that the spatial object in Umbraco has been updated with the id - good news! :)
The bad news is that in the actual Umbraco editor which I've got open in my web browser which reloads after publishing doesn't reflect the updated spatial property in the document which I've just updated in the event handler.
Is this an issue with Umbraco just using what's in the viewstate, rather than reloading data from the document object? Either way, what's the best known solution to this problem?
Using Document.BeforePublish to update a property
I'm registering against the Document.BeforePublish Umbraco event handler, so that my application can strip out spatial data (Which is held in Umbraco serialized to XML).
When new spatial data is detected it's added to a seperate table in the database which is designed to hold spatial data in a format it can be searched/manipulated using the SQL Server 2008 spatial tools.
The long and short of this is that when an Umbraco document containing spatial data is published, the spatial data is inserted into another table and then the id of the newly inserted spatial data is added back into the Umbraco document.
sender.getProperty(umbracoPropertyAlias).Value = JsonConvert.SerializeObject(documentGeometry);
This works - I can see from looking at umbraco.config that the spatial object in Umbraco has been updated with the id - good news! :)
The bad news is that in the actual Umbraco editor which I've got open in my web browser which reloads after publishing doesn't reflect the updated spatial property in the document which I've just updated in the event handler.
Is this an issue with Umbraco just using what's in the viewstate, rather than reloading data from the document object? Either way, what's the best known solution to this problem?
Thanks
Pete
This is a bit of an old post, but I just noticed the same behavior. Did you ever figure out the issue?
Unfortunately not.
The project which used this particular piece of code is currently on hold, meaning I've not yet needed to find a fix.
If you're able to find a solution, I'd really appreciate it if you could share your solution.
Good luck!
Peter, actually I found a solution... You need to call this after your document save:
BasePage.Current.ClientTools.ClearClientTreeCache();
At least that worked for me with Umbraco 4.11.4
is working on a reply...