Skip to main content

Create an Activity

This article will walk you through creating a new workflow activity for web applications.

Prerequisites

Set up the VertiGIS Studio Workflow TypeScript SDK.

Create an Activity

  1. Open up a terminal shell in the project folder.
  2. Run the command npm run generate and follow the instructions to create a new activity named MyCustomActivity. This script creates a custom activity skeleton that you can build on with your own custom logic. The script will perform the following operations:
    1. Create a new activity .ts file with the provided name in the src/activities folder.
    2. Populate the activity .ts file from an activity template.
    3. Register the activity in src/index.ts.
tip

It's convention to use PascalCase for activity names. You can add multiple activities and form elements to the same project. The name of your activity should not be modified after it has been deployed, as it is a unique identifier used by the Workflow runtime.

In the VertiGIS Studio Workflow TypeScript SDK, activities are represented as simple classes with an execute method.

/**
* @displayName MyCustomActivity
* @category Custom Activities
*/
export class MyCustomActivity implements IActivityHandler {
/** Perform the execution logic of the activity. */
async execute(
inputs: MyCustomActivityInputs
): Promise<MyCustomActivityOutputs> {
return { result: "test" };
}
}

Deploy the Activity

Follow the instructions to deploy the activity pack.

Test the Activity

Once your activity pack is hosted and registered, your custom activity should appear in the activity toolbox in VertiGIS Studio Workflow Designer alongside the built-in activities, and can be used in the graphical interface like any other activity.

Now you can build a workflow that uses your new custom activity!

Next Steps

Calculate a Logarithm with a Custom Activity

Implement a custom activity that calculates the logarithm of a number

Activity Reference

Learn more about implementing custom activities

Add a Layer to the Map with a Custom Activity

Access application properties like the map in custom activities for Web Applications

Use the ArcGIS API for JavaScript in an activity.

Use the ArcGIS API for TypeScript in an activity or form element