This project is read-only.

Workflow - Content Created item has all fields at null

Topics: Customizing Orchard
May 27, 2014 at 9:33 AM
Hi everyone

I'm trying to create a workflow to notify another service of changes on a bunch of content types. I created a Task to use in this workflow that sends the data from the item to the service.

For this effect I created a workflow that starts with the "Content Created" event and connected this event with my Task. The thing is when I access the ContentItem in the workflow context, the item is there, it has an id but all the values for its fields are still null...
public class NotifyServiceActivity : Orchard.Workflows.Services.Task
        public override IEnumerable<LocalizedString> Execute(WorkflowContext workflowContext, ActivityContext activityContext)
            ContentItem addedItem = workflowContext.Content.ContentItem;
In the above code, all works good except for the fact that the contentParts in addedItem have all the default values... and not the values inserted by the user...

Another thing I noticed, is that after the "Content Created" event is triggered, the "Content Published" and "Content Updated" events are also triggered, both have the fields all field correctly... so this has something to do with the moment the "Content Created" is triggered...
Because I'm using an OData interface to sync with the service, I need to distinguish between Add, update and delete events (the delete ones are easy, my problem is with the other 2....)

Did any of you guys have similar problems with workflows? Do anyone of you have any suggestions or ideas?

many thanks