This project is read-only.

How to update content field value in workflow Execute

Topics: Customizing Orchard
Dec 16, 2014 at 6:43 AM

I have created a content field to keep content item's number. When the content item is released.
I must change its number into release number. But I can't persistent it into database.
My code is below:
    public override IEnumerable<LocalizedString> Execute(WorkflowContext workflowContext, ActivityContext activityContext) {
        var docPart = workflowContext.Content.ContentItem.As<DocumentPart>();

        if (!workflowContext.Content.ContentItem.HasPublished())
            var docField = (DocumentField)docPart.Fields.Where(r => r.Name == "DocumentField").Single();

            docField.Number = _documentPartService.RetrieveReleaseDocNum(docPart);
How to persistent content field ?
Marked as answer by ezrachen on 12/15/2014 at 11:05 PM
Dec 16, 2014 at 7:05 AM

I miss, RetrieveReleaseDocNum() has bug, Sorry , Cancel the problem

Thanks! Best Regards!
Marked as answer by ezrachen on 12/15/2014 at 11:06 PM