1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Module Create Item Issue

Module Create Item Issue

3 posts, 0 answered
  1. Marc
    Marc avatar
    24 posts
    Registered:
    09 Jun 2011
    08 Jul 2011
    Link to this post
    Created a module called article basing it off of the products module, but I am receiving the error 12152 when I try to publish a new article.  All fields render properly on the creation page but the Model class doesn't seem to populate with the values.  I have walked the code and the Copy method in the Manager Class: 

    public void Copy(ArticleItem source, ArticleItem destination)
            {
                this.Provider.CopyContent(source, destination);
                //destination.Urls.ClearDestinationUrls(source.Urls, this.Delete);
                //source.Urls.CopyTo(destination.Urls, destination);
     
                //Not going through the Content property as it has logic that strips all localizable values of the Lstring.
                //destination.GetString("Content").CopyFrom(source.GetString("Content"));
     
                //that's how we copy lstring-s           
                destination.ListTitle = source.ListTitle;
                //destination.WPSUser = source.WPSUser;
                destination.Editor = source.Editor;
                destination.ContentOwner = source.ContentOwner;
                destination.ExpertReviewers = source.ExpertReviewers;
                destination.TargetPublishDate = source.TargetPublishDate;
                destination.UpdateDate = source.UpdateDate;
                destination.ReviewDate = source.ReviewDate;
                destination.Section = source.Section;           
            }


    Never populates the source ArticleItem so when it tries to copy it to the destination it writes over null thus causing the 12152 error as I cannot insert null into a datetime column.  What am I missing, or where should I look to make sure on the publish action of creating an item that the values are fed back properly as obviously I am missing something which allows the values to be passed back to the create method? Oh here is a view of one of the fields: 

    var sectionField = new TextFieldDefinitionElement(mainSection.Fields)
               {
                   ID = "SectionField",
                   DataFieldName = "Section",
                   DisplayMode = displayMode,
                   Title = "Section",
                   ResourceClassId = typeof(ArticlesResources).Name,
                   WrapperTag = HtmlTextWriterTag.Li
               };


    Cheers, 

    Marc
  2. Marc
    Marc avatar
    24 posts
    Registered:
    09 Jun 2011
    08 Jul 2011
    Link to this post
    Ok, looks like the first error was because I was missing the App.Config file.  Figured that out by comparing my project to the Products Module in the SDK.  Although this is missing from the online documentation that seems to have moved me on to a web service deserializing error.

    There was an error deserializing the object of type Telerik.Sitefinity.Web.Services.ContentItemContext'1[[Article.Model.ArticleItem, Article, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]. End element 'ContentOwner' from namespace '' expected. Found element 'item' from namespace ''.

    Note to Telerik, please update your online support documentation since it will be the first place some people look when investigating your product for usage.  When it is constantly wrong and or out of date it makes the people who wish to adopt your products into enterprises second guess their convictions for using the product at all.  
  3. Marc
    Marc avatar
    24 posts
    Registered:
    09 Jun 2011
    08 Jul 2011
    Link to this post
    Removed three of my fields that were dropdowns that were lookups for users and pointed the App.Config to the proper table.  Got the module to insert.  Had to also remove a custom control that was for a calendar field (radcalendar) as it was not saving the proper date when it was sending it across the wire (i.e. the date 1/1/2010 was selected but it would always send 0/0/0001 or whatever the default date was). Will have to figure these things out next before moving on to the harded tasks I have on the list. 
3 posts, 0 answered