OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.38k stars 1.12k forks source link

Workflow: New Content Updated Event #3860

Closed orchardbot closed 9 years ago

orchardbot commented 11 years ago

@jtkech created: https://orchard.codeplex.com/workitem/20032

To send an email on CustumForm submission, I have tried the new Content Updated Event in WorkFlow. It works fine but it is triggered before data validation. So, the mail can be sent even with an empty message, if ReCaptcha words are not correct...

I don't use the Publish Event, triggered after data validation, because here the CustomForm SaveContentItem option is false. I don't use the Create event that is also triggered before data validation. Anyway, to minimize database when the SaveContentItem option is false, I don't create a persistent contentItem (http://orchard.codeplex.com/workitem/19940)

A solution is to trigger a generic event after data validation in CustomForms ItemController.cs (as for the Rules event):

_workflowManager.TriggerEvent(SignalActivity.SignalEventName, contentItem, () => new Dictionary<string, object> { { Content", contentItem }, { SignalActivity.SignalEventName, contentItem.ContentType + " Submitted" } });

Right now I still use Orchard 1.6.1 and Orchard.Rules, and I can use this solution for Orchard 1.7 and WorkFlow, but I prefer to use source code without modification

Thanks

orchardbot commented 11 years ago

@sebastienros commented:

Fixed in changeset 936e790c95c1f7b80cb2c2d80c7e7d06f051df8b