Skip to main content

Create an Activity

This article will walk you through creating a new workflow activity for VertiGIS Studio Workflow Server.

Prerequisites

Important

Extending VertiGIS Studio Workflow with server side components requires an on-premises installation of VertiGIS Studio Workflow. You will need administrative access to this installation.

Follow the instructions in the VertiGIS Studio Workflow Server page to set up your development environment and VertiGIS Studio Workflow Server extension project.

note

A working knowledge of C# and .NET Standard is recommended before extending VertiGIS Studio Workflow Server

Create the Activity

  1. Create a new file CustomActivity.cs in the root of your VertiGIS Studio Workflow Server extension project.
  2. Add a new skeleton workflow activity that implements IActivityHandler.
App1/App1/CustomActivity.cs
using VertiGIS.Workflow.Runtime;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace App1.Workflow
{
public class CustomActivity : IActivityHandler
{
public static string Action { get; } = "uuid:<uuid>::CustomActivity";

public Task<IDictionary<string, object>> Execute(IDictionary<string, object> inputs, IActivityContext context)
{
return Task.FromResult((IDictionary<string, object>)new Dictionary<string, object>(){
["test"] = "value"
});
}
}
}

Register the Activity with an Assembly Attribute

  1. Create a new file, Properties\AssemblyInfo.cs
  2. Add the custom VertiGIS Studio Workflow attribute to AssemblyInfo.cs:
App1/App1/Properties/AssemblyInfo.cs
[assembly: VertiGIS.Workflow.Runtime.WorkflowActivities]

This registers the assembly to a namespace that VertiGIS Studio Workflow Server can discover.

note

By convention, assembly attributes are typically added to a file called "Properties\AssemblyInfo.cs", but they can be added to any code file.

Deploy the Activity

Follow the instructions to deploy VertiGIS Studio Workflow Server activities.

Use the Activity in a Workflow

Server workflows that run on your VertiGIS Studio Workflow Server deployment can now run this custom activity.

tip

Registering stubs for .NET activities provides a user friendly interface for your custom activities in VertiGIS Studio Workflow Designer.

You can run the custom activity by referencing it by action with the RunActivity activity. The custom activity created in this article takes no inputs but produces an output with the property "test".