Reacting to application events

Note: this feature is applicable when oeWorkflow is embedded in an oeCloud application.

oeWorkflow engine provides an application mixin (WorkflowMixin) which can automatically trigger the specified workflow when a particular application event occurs. The linkage between application event and workflow process is defined in (WorkflowMapping) model.

To define a Workflow Mapping call following API.

Url Verb Payload
/api/WorkflowManagers/workflow POST As explained below
{
  "modelName" : "...",
  "version":"v0",
  "operation": "...",
  "workflowBody" : {
    "workflowDefinitionName" : "...",
    "processVariables": {
      ...
    }
  },
  "remote": {
    "path": "/myremote",
    "method": "myRemoteMethod",
    "verb": "POST"
  }
}

Property Required? Description
modelName Yes Application model name. Workflow engine will listen to events of this model and will trigger the flow if a events matches with specified operation.
version Yes When version is v0, the workflow process is triggered without affecting the event. A value v2 enables maker-checker functionality on the model.
operation Yes create: trigger flow when record is created, update: trigger flow when record is updated, save: trigger flow when record is either created or updated, delete: trigger flow when record is deleted, custom: trigger flow when a custom remote is called. Additional remote details are required in this case (see below).
workflowBody.workflowDefinitionName Yes BPMN process name to trigger
workflowBody.processVariables No Initial process variables to inject.
remote.path if operation: 'custom' Custom remote API path to match when operation is custom.
remote.method if operation: 'custom' Custom remote method name to match when operation is custom.
remote.verb if operation: 'custom' Http verb to match when operation is custom

The posted data are stored in WorkflowMapping model and event listener is attached to the provided model/api. If the event matches to one of the defined mapping, the engine triggers the specified workflow passing the relevant data.