Content Item Data not being persisted in Orchard_Framework_ContentItemVersionRecord

Topics: Customizing Orchard, General
Editor
Aug 20, 2015 at 8:17 PM
I am trying to validate data of a content item being submitted via a custom form.
  1. I Turned off "Create Content On Submission"
  2. I added a validation step to my custom workflow
  3. When the validation passes, I want to persist my item to the DB.
  4. The Custom Forms module passes a ContentItem to the Workflows context so you can do things like publish and delete content items so I figure this would be fine.
  5. In the module I take the content item that is passed and do the following :
        var contentItem = workflowContext.Content.ContentItem;
        _contentManager.Create(contentItem, VersionOptions.Draft);
        _contentManager.Publish(contentItem);
    
        yield return T("Done");
    
  6. This results in the data being persisted to the Orchard_Framework_ContentItemRecord table instead of in the Orchard_Framework_ContentItemVersionRecord table, which is why I believe I don't see any data under "Submissions" in the UI.
The Custom Forms module create's a new Content Item, and I have the same code as if I was asking it to save it via the Custom Forms module so it is confusing.

In the CREATEPOST controller for forms :
        var customForm = form.As<CustomFormPart>();
        var contentItem = _contentManager.New(customForm.ContentType);
This contentItem get's passed along to the workflows.