Table of contents

  1. General information
  2. How to connect a plugin to Workflow Runtime
  3. How to connect a plugin to Workflow Server
  4. How to write a plugin of your own

General information

Table of contents

A plugin is a class that extends the functionality of WFE, and specifically:

  • Adds predefined Actions, Conditions and Authorization rules to the schemes designer.
  • Performs additional processing of the Workflow Runtime standard events .
  • connects a provider of external parameters to your processes The WFE package includes a set of predefined plugins; the features they add are described futher in this section.

How to connect a plugin to Workflow Runtime

Table of contents

In case of using WFE as an embedded solution, you should connect plugins when initializing Workflow Runtime. It can be done with the following simple code.

var basicPlugin = new OptimaJet.Workflow.Core.Plugins.BasicPlugin();
// Settings for SendEmail actions in the Basic Plugin
plugin.Setting_Mailserver = "";
plugin.Setting_MailserverPort = 25;
plugin.Setting_MailserverFrom = "";
plugin.Setting_MailserverLogin = "";
plugin.Setting_MailserverPassword = "password";
plugin.Setting_MailserverSsl = true;
plugin.UsersInRoleAsync = UsersInRoleAsync; //simple delegate to access your security system roles

var filePlugin = new OptimaJet.Workflow.Core.Plugins.FilePlugin();

var runtime = new WorkflowRuntime()
//The basic Workflow Runtime is skipped here

Here we perform the following procedures:

  • Create instances of the two plugins, BasicPlugin and FilePlugin.
  • Set up the plugins.
  • Register them in WorkflowRuntime calling the WithPlugin method;
  • Start the runtime.

After that, the Actions, Conditions and Authorization rules, which plugins add to the schemes designer, become available. For example, if you connect BasicPlugin to WorkflowRuntime and set the default parameters for the mail server, you can select the SendEmail Action in the Implementation section (or PreExecution Implementation) in the Activity editor. You can specify the body, title and recipient of the message in the Action parameter editor.



The WithPlugin() method has a second optional parameter of type List<string> to specify a list of the codes of the schemes able to use the functionality added by a plugin. If the list is not specified, as in the samples above, then the functionality is added for all of the schemes.

How to connect a plugin to Workflow Server

Table of contents

To connect a plugin to Workflow Server, go to the Dashboard page and the Plugins tab. You should simply enable the plugin with the toggle and establish its settings, if any. After that, the functionality added by the plugin will become available for all of the schemes.


How to write a plugin of your own

Table of contents

A plugin is a class that must implement the IWorkflowPlugin interface. This interface is very simple.

public interface IWorkflowPlugin
    string Name { get; }
    Dictionary<string,string> PluginSettings { get; }
    void OnPluginAdd(WorkflowRuntime runtime, List<string> schemes = null);
    void OnPluginRemove(WorkflowRuntime runtime);

The interface members are assigned as follows:

  • Name - the plugin name.
  • PluginSettings - the dictionary of the plugin settings.
  • OnPluginAdd - called when the plugin is added to the runtime. This method is convenient for subscribing to the WorkflowRuntime events.

Also, the plugin class can optionally implement the following interfaces in any combination.

Thus, you get a class that connects to WorkflowRuntime by calling the WithPlugin() method only, and adds a certain class of functions to your system.

Table of contents