Create your first SDK plugin

This article applies to BPS versions 2019.1 and higher. The document for older versions is available at this link.

Creating a project with WEBCON BPS SDK plugin

This article will show you step-by-step how to create a project that contains a custom action – which is one of the types of SDK plugins.

In order to develop your own plugins you may need the SDK license and you have to have WEBCON BPS SDK installed.
As an example, we will create a project with a simple custom action which will update the value in a form field.

Setup

At the moment, we provide two different project templates.
The BPS 2019 Extensions – Logic is the template created in order to help you develop logic parts of your plugins.
The BPS 2019 Extensions – SharePoint 2013|2016|2019 UI Controls is the template created in order to help you develop the UI parts of your plugins.

You can find the BPS 2019 Extensions – SharePoint 2013 UI Controls, BPS 2019 Extensions – SharePoint 2016 UI Controls and BPS 2019 Extensions – SharePoint 2019 UI Controls templates installers in resources inside “Visual Studio templates” section.

When it comes to BPS 2019 Extensions – Logic templates installer you can find it in Visual Studio Marketplace
You can also download it through “Extensions and Updates…” Visual Studio extensions manager.

Creating project

The process of creating the BPS Extensions project is very simple. You can create Class Library project but you can also make use of one of our templates which makes this process even more effortless.

Create SDK project

One thing to note is the fact that you can only create a SharePoint BPS Extensions project in a solution that already contains the logic project. Without going into technical details, we have decided to impose this limitation to make the development of SDK plugins as easy as possible.

Adding WEBCON BPS SDK libraries files

If you are using one of our project templates you can skip this step, because their goal is to set everything up for you. However we recommend reading this short section so that you can have the knowledge of how you can add WEBCON BPS SDK DLL files to projects created without our templates. They are needed to develop your own plugins in the future.

There are two places from where you can get them:

  • SDKLibraries directory inside the installation package
  • NuGet packages

When it comes to NuGet packages you can download them through built in Visual Studio NuGet Package Manager or make use of other options provided by NuGet which are shown on their
website.
Just install the version for which you will be developing your plugins, and you can start writing your code.

Visual Studio Nuget manager

Nuget store SDK Logic

Nuget store SDK controls

Creating WEBCON BPS SDK plugins

To develop an SDK plugin, you can also make use of one of the provided templates to speed things up. They will guide you step-by-step through the configuration process.

Create custom action

Template designer

The BPS 2019 Custom Action template contains an example of code which we will use in this article.
Just uncomment the code shown here:

If you would like to go through the creation process without using our templates, we recommend reading next two sections. Otherwise you can skip them and go straight to section named “Plugins package manifest”.

Creating a plugin configuration without templates

In order to create a plugin configuration, you have to derive from PluginConfiguration class available in WebCon.WorkFlow.SDK library. The plugin configuration class consist of set of public properties. Every property has one of our attributes which are all in the form of Config[…] The description of each of them is available in a separate article.

Creating a custom action without templates

In order to create custom action you have to derive from CustomAction generic abstract class, and then pass as the type the parameter plugin configuration which you have created in the previous step. CustomAction generic abstract class contains set of virtual methods and properties that you can override in order to provide your custom implementations. One of them is the Run method which we are going to use and which is invoked in many different scenarios. Again, you can read more about all of these methods and properties in a separate. We will not quote it here to make this example as simple as possible.

Plugins package manifest

The Manifest is the JSON file specifying information about plugins contained within the DLL file. This metadata is then used by plugin registration mechanism to discover the proper code.
If you use default settings applied by our project template, the manifest will be filled in automatically every time you add a new plugin.
You can check the current state of your manifest and edit it inside the JSON file which name is the same as the project.

Creating Strong Name Key

For development purposes, we sign all projects created with the use of our templates with temporary key (temporary_key.snk). Although it may be enough to test our plugins we recommend to sign projects with your own digital signing key.

Create stron name key

Creating a plugin package

In order to register plugins in WEBCON BPS – Designer Studio, you have to create package which is a zipped directory that contains the project’s DLL file and the manifest.
We provide you with the PowerShell script which will automatically create all required files to run your plugins inside the Publish directory every time you build your project. You are free to check the script and edit it to match your custom needs. You can find it under the Build\Postbuild directory.

Registering plugins package

You register plugins package in WEBCON Studio as shown below. It will register all your plugins inside the package automatically.

Register plugins package

Plugins packages are versioned. Without going into details we use AssemblyVersion attribute to control it.
All you have to do is to keep in mind that any changes to plugins must be followed by increasing assembly version number. You can do this by editing AssemblyInfo.cs file inside your project.

Configuring the action

The last step is configuring the custom action that you have written. For the purpose of this example we will create new WEBCON application called HelloWorldApplication with HelloWorldProcess which will contain just two steps – Start and Finish (positive). We will attach created action on exit path from Start step.

Start with creating the structure like below:
Example workflow

Next, create a form field inside your process which will be updated using our custom action.
Example attribute

In order to make this form field visible on your forms, you have to check the appropriate checkbox in field matrix tab inside your Main form configuration.
Attribute visibility

Then to add the custom action to be triggered On exit from the Start step. Add new action, set its type to ‘Run an SDK action’ and select it from ‘Plugin (SDK)’ dropdown. Once you have done this you can click ‘Configure’ button to fill configuration of your custom action.
Register custom action
Plugin configuration

Make sure to save your process to confirm all your changes.

And that’s it. You have created your very first custom action which will modify the value of the defined form field.
Congratulations!