Skip to content

Create your own activity

Concept

In zervicepoint you can have your own PowerShell or C# functions executed in the workflow or in the webform.

There are four types of functions that are written:

System  Type Comment
Form Web Service Function used for the purpose of looking up data dynamically in the form with javascript.
Form Data Source (DropDown) Used to dynamically populate a DropDown, Checkbox
Form Data Source (Table) Used for zervicepoint tables - Must return a PSObject
Workflow Activity Must return a hashtable - any Key in the hashtable that matches the name of an assign variable in the process, will be stored in the running workflow and can be used as input/output to another activity/form.

This is done by two zervicepoint components:

  • ProvisioningSystem - This service will run and inventory which available functions you can use in your service.
  • ClientWebService/ProvisioningSystemInventory - ClientWebService will run functions for the webform. ProvisioningSystemInventory will inventory them.

Providers

These are the providers available for your processes. Providers are functions in PowerShell scripts that are inventoried by the ZervicePoint Windows services.

Data sources

These are the data sources available for your forms and dynamic drop-down lists. Data sources are functions in PowerShell scripts that are inventoried by the ZervicePoint Windows services.

Quickstart

In order to create our own activity, we will need to create the following on the provisioningsystem server.

  • A PowerShell Module
  • A plugin xml file (pluginname.provisioningsystem.provider.xml)

Create a zervicepoint plugin in PowerShell

Start PowerShell (run as admin)

Create the following folder structure

C:\Plugin
C:\Plugin\ZPDocs\Activites
C:\Plugin\ZPDocs\Activites\Activity.ZPDocs

To quickly create the structure above you can run the following powershell commands

New-Item -ItemType Directory -Path 'C:\Plugin\ZPDocs\Activities\Activity.ZPDocs'

Create PowerShell Module Manifest

New-ModuleManifest -Path C:\Plugin\ZPDocs\Activities\Activity.ZPDocs\Activity.ZPDocs.psd1 `
-RootModule "Activity.ZPDocs.psm1" `
-FileList @("Activity.ZPDocs.psd1","Activity.ZPDocs.psm1") `
-PowerShellVersion 3.0

Write function to PowerShell Module

Copy the function and insert it into the .psm1 file

$psm1 = @"
function Get-DayOfWeek {    
    @{
        DayOfWeek = (Get-Date).DayOfWeek.ToString()    
    }
}
"@

$psm1 | Out-File 'C:\Plugin\ZPDocs\Activities\Activity.ZPDocs\Activity.ZPDocs.psm1' -Encoding UTF8

Create a plugin xml

The provisioningsystem provider xml contain metadata for the plugin, name, scriptpath. It is also possible to extend this file with custom keys that can contain configuration related to the plugin. URLs etc

There are initial two important metadata configurations you will need to update when creating your own plugin.

Enter a name for your plugin. (This name must be unique)

<provider name="Learn zervicepoint">

Update scriptpath. (It should point to the location where the activity modules for your plugin are located)

<add key="scriptpath" value="C:\Plugin\ZPDocs\Activities\" />

Copy and paste the following code in a powershell prompt to create a plugin XML file.

$pluginxml = @"
<?xml version="1.0" encoding="utf-8"?>
<providers>
<provider name="Learn zervicepoint">
    <assembly type="Zipper.ZervicePoint.ProvisioningSystem.PowerShellProvider.PowerShellEngine" assemblyFile="C:\Program Files\Zipper\ZervicePoint\ProvisioningSystem\Providers\PowerShell\Zipper.ZervicePoint.ProvisioningSystem.PowerShellProvider.dll" />
    <configuration>
    <add key="scriptpath" value="C:\Plugin\ZPDocs\Activities\" />
    </configuration>
</provider>
</providers>
"@

$pluginxml | Out-File 'C:\Program Files\Zipper\ZervicePoint\ProvisioningSystem\ZPDocs.provisioningsystem.providers.xml' -Encoding UTF8

Trigger Inventory

To inventory new activties, you can choose one of the following methods.

Restart-Service -Name ProvisioningSystem

Search for function in Providers page (AdminWeb). If not found - add instructions on how to troubleshoot.

provider-dayofweek

Now that the activity is inventoried, you can use it in your workflow.

provider-dayofweek