Integrating Workflow with Custom module

Topics: General, Jobs, Writing modules
Mar 9, 2015 at 3:45 PM
I have created a custom module in my application to publish few application related contents since i cant use the general content page. I want to integrate workflow on my save button click since i have to send few notification to managers to approve the content and need to send reminders to them . Is it possible to do the same using Orchard workflow? Or do i need to create separate WWF application??
Mar 9, 2015 at 5:45 PM
Edited Mar 9, 2015 at 5:45 PM
It should not to hard to do it with Orchard workflows. You have to create your own Event and trigger it after your SaveButton is clicked.

Trigger your Event:
// Inject IWorkflowManager
private readonly IWorkflowManager _workflowManager;

// Trigger your event 
_workflowManager.TriggerEvent("YourEventName", (IContent)ContentItem, () => tokens);
The first parameter for the TriggerEvent function is the name of your Event, the second one is the contentItem associated with the event and the last one is a dictionary if you want additional tokens.

In the orchard workflow a event has to derive from Orchard.Workflows.Services.Event. Take a look at the UserModule and the UserActivities.