Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Document type custom fields loosing values View modes: 
User avatar
Member
Member
brien-anca - 6/2/2011 11:02:29 PM
   
Document type custom fields loosing values
I have a document type with a couple of custom fields which I have built a custom control through which I set the data programatically in the form tab of CMS Desk for pages of that type.

As I move through the workflow to published state, all is fine. But if the document then reenters edit state, when it progresses back through to published state, the values seem to have been cleared out.

I'm using
node.SetValue("MyFieldName", value);
node.Update();
to write the data inside the control

and ValidationHelper.GetString(node.GetValue("MyFieldName"), "");
to read the data back out.

User avatar
Member
Member
lancetek - 6/3/2011 2:06:19 AM
   
RE:Document type custom fields loosing values
I'll take a shot - I think it has something to do with using versioning - I seem to remember that when you are accessing a versioned document, you use a slightly different API to access the versioned info: versioning internals
...For versioned documents (with workflow assigned), only the published data is stored in the tables described in...


So I guess when you 'unpublish' the document, the data is cleared from the 'base' node object? In any case the docs clearly state that you should be using the 'DocumentHelper' class to alter or read node fields:
You should always use DocumentHelper for the document operations if not sure whether the document is versioned or not, the DocumentHelper methods will choose the proper actions for you.


I hope this helps!

Cheers,
Lance