Hi Everyone,
I have a page which has a CMSForm object on the page which allows the end user to edit a document that they are assigned to (custom.Driver).
This works fine and the user can edit their document and their changes are reflected inside Kentico form tab.
However I have recently turned on the default Edit -> Published -> Archived workflow and even though it edits the document and it appears inside the CMS (And appears as published not edited), On the front end of the site it holds onto the old version of the document and for example displays the old name (even after clearing the cache).
Only if I go in and re-edit the document and then click on publish does it apppear on the front end of the site.
My question is how using the API do I make the latest version the version that the site listens to?
I have the following code on the onaftersave method of the CMSForm to find the document that has been edited.
TreeNodeDataSet tnds = TreeHelper.SelectNodes("/%", true, "custom.Custom", string.Format("DriverID = {0}", DriverID), "", -1, false);
if (!DataHelper.DataSourceIsEmpty(tnds))
{
TreeNode editingNode = tnds.FirstOrDefault();
// ON THIS EDITING NODE HERE THE NAME OF THE DOCUMENT IS 'DRIVER 1' which is the one that is currently live showing the old name.
// If I use documentHelper.GetDocument which always returns the latest document version then
editingNode = DocumentHelper.GetDocument(editingNode, new TreeProvider());
// ON THIS EDITING NODE HERE (THE LATEST ONE) THE NAME OF THE DOCUMENT IS (RIGHT) 'DRIVER 1 AFTER UPDATE' WHICH IS CORRECT.
The site (repeaters/list menus etc.) all show DRIVER 1 even after a clear of the cache.
Any Idea how I promote the latest version to be the one that it listens to? Even thought it's showing as published in the workflow step and inside Kentico CMS it still uses the old name in repeaters etc even after clearing the cache, the only way to get it to display is to go into Kentico change the document slightly and then click save and re-publish.
Any Help would be greatly appreciated.