Portal Engine Questions on portal engine and web parts.
Version 7.x > Portal Engine > Auto Publish not working in code View modes: 
User avatar
Member
Member
jukkausb-mail - 4/10/2013 3:52:15 AM
   
Auto Publish not working in code
Good morning.
We have the following issue.

We have a tree node object (custom doc type), we update its fields and try to persist changes to DB. Doc type is configured for autopublishing changes.
Here is the code example.
TreeProvider tree = new TreeProvider(SecurityContext.Current.User);
TreeNode claimNode = DocumentHelper.GetDocument(claim.NodeID, CMSContext.CurrentDocumentCulture.CultureCode, tree);

// update fields code.....

DocumentHelper.UpdateDocument(claimNode, tree);

// also we tried the following code to update and publish

// Option1. - claimNode.Update();
// Publish node
// Option2. - claimNode.MoveToNextStep(string.Empty);

// Option3. - WorkflowManager workflowManager = WorkflowManager.GetInstance(tree);
WorkflowInfo workflow = workflowManager.GetNodeWorkflow(node);

// Check if the document uses workflow
if (workflow != null)
{
workflowManager.PublishDocument(node, null);
}

Each of these attempts does not result in updating custom doc type table. The changes are reflected in the CMSDesk (there we have new values and it says that document workflow step is PUBLISHED) and even in the TreeNode object, but not in the database.

Have can we ensure that changes are populated to the custom doc type table?

User avatar
Kentico Support
Kentico Support
kentico_filipl - 4/16/2013 10:12:33 AM
   
RE:Auto Publish not working in code
Hello,

Are you trying to update custom document type? In that case using WorklowInfo and WorkflowManager does not make much sense to me since it only affects documents and not document types. Because as I look in the code, it updates one particular document which is of some document type. I have tried your code (with some necessary modifications for a particular tree node) and it was behaving as expected - one certain document was updated and these changes were also reflected in database.

So, could you please confirm you are trying to update the whole document type structure and not just one document?

Best regards,
Filip Ligac