Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > How to get a custom document field programatically. View modes: 
User avatar
Member
Member
Leandro Brito - 12/20/2011 10:27:46 AM
   
How to get a custom document field programatically.
Hi,

I have a custom document type and I need get the value of one field to create a new alias path in my CustomEventHandler project, using the method OnBeforeInsert.

How can I get the value of field on my Custom.MyDocument table?

Thanks.

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 12/21/2011 10:05:02 AM
   
RE:How to get a custom document field programatically.
Hello,

If you've retrieved the current document, you should be able to get the value with the GetValue method. For example, with a valid context, the code below should work:

string dn = CMS.CMSHelper.CMSContext.CurrentDocument.GetValue("ColumnName");

Best regards,
Boris Pocatko