How to Trigger "Task" Activity from Driver or Controller?

Topics: Core, Customizing Orchard, Writing modules
Dec 10, 2014 at 7:31 AM
Edited Dec 10, 2014 at 12:03 PM
I wan't to create an activity which can be executed within the workflow like other task activities and can also be invoked from outside like event activities can be triggered from Controller or Driver.

If you create an activity as a Task activity, it will be executed in a flow but cannot be invoked from Controller or Driver, and if you create activity as an Event activity, it can be invoked from Controller or Driver but this will not execute in a workflow. Is it possible in orchard.

Dec 10, 2014 at 5:02 PM
I have no idea if it is possible to invoke a Task Activity in your controller because it may depend on a workflowcontext or something like that.
My workaround would be creating two activites - one of type event and one of type task. Then fire the event in your controller and config your workflow that this event triggers your activity.
Marked as answer by cloudsurfer on 12/10/2014 at 10:18 PM
Dec 11, 2014 at 5:17 AM
Thank you Benedikt. This seems to be the only way.

Dec 15, 2014 at 8:12 PM
Did you look at the Signal activity? Signal waits for a signal to be sent (and that is done from code, typically), and Trigger sends a signal (but you can also do it from code).