I have a custom document type called health article.
When I use the API to create a new document, it does not honor the default values for the fields that I have set in the CMS Site Manager. I.e., I have a field IncludeInWeeklyAlert with the default setting to true. When I create a new node of this type, I receive an error that the field cannot be null.
var tree = new TreeProvider(UserInfoProvider.GetUserInfo("administrator"));
using (var parentNode = tree.SelectSingleNode(CMSContext.CurrentSiteName, parentNodePath, "##ALL##", true, "CMS.MenuItem", false))
{
var dataClass = DataClassInfoProvider.GetDataClass(CustomFunctions.CustomArticle);
if (dataClass == null)
{
throw new Exception("Given document type does not exist.");
}
// Create a new instance of the Tree node
var newNode = TreeNode.New(CustomFunctions.CustomArticle, tree);
// Set the document's properties
// Insert the document into the content tree
newNode.Insert(parentNode);
How can I use the API to get the default value, so that I do not have to put the default value in more than 1 place?
Thanks,
Joe Hoppe