Creating a new WorkCycle activity

WorkCycle is comprised of two components:

  • Windows service

  • Workflow Designer

The designer allows you to build processes that can then be executed by the windows service. In WorkCycle, these processes are called workflows. A workflow consists of one or more activities. This document will help you to build an activity.

Workflow

  • Start and End Activities
    The first and last activities in a Workflow template are the Start and End activities. The Workflow Designer adds them to a workflow template automatically when you drag an activity from one of the activity groups to the canvas.

  • Start + Activity + End = Workflow

    Workflow Activities Panel

    image1

    image2

Development Environment

Everything that is needed to create a workflow is explained in this section.

Software Requirements

  • WorkCycle
    Installed and running

  • Microsoft Visual Studio
    Installed and running

  • Microsoft Framework
    See Installation for versions.

  • Visual Basic or C#

Required References

To create a new activity for WorkCycle, Visual Studio must be set up with the following references.

WorkCycleAPI.dll must be stored in the reference folder in which Activity is stored.

image3

Activity

Activities Panel

The name of the activity appears in the Activities panel in the Workflow Designer and is defined in the PlugIn as Activity_type.

image4

Activity methods are:

  1. Initialize

  2. Friendly Name

  3. Global Options

  4. Required Fields

  5. Execute

  6. Output Fields

Initialize

  • Part of the class initializer inherited from PluginBase

  • Initialize will include the definition of Activity Type

image5

Friendly Name

  • The actual name of the activity as it is displayed in Activities list in the designer.

  • The FriendlyName defined in the code:
    image6

  • The Friendly Name also appears in the Activities drop down. Once the activity is used in a workflow, the activity appears there too.

    Activities Panel Workflow

    image7

    image8

Global options

Global options are parameters that can be used in more than one activity but the value remains the same.

image9

In this example, the IP Address is global and remains the same for all instances of the Email User activity.

image10

Required Fields

Required fields are parameters that change for each instance of an activity.

image11

In this example, the 'to_email' parameter is a local variable.

image12

Execute

  • Write your code here.

  • All the work that happens within your activity is executed here.

image13

Output Field

  • Field name that contains the return value from your activity.

  • In this example, the Output Field returns Result.

    image14

    image15

Coded Activity

image16

Public Methods

Log Message String

  1. Enabling the log

    • Stop the Workflow service

    • Go to workflow.exe.config

    • C:\Program Files (x86)\TMW Systems, Inc\WorkCycle.Net

    • Workflow.exe.config opens in Microsoft Visual Studio

    • Set log file option to True

    • Restart the Workflow service

    Log File Option:

    image17

  2. Location of the log for viewing logged messages
    C:\Program Files (x86)\TMW Systems, Inc\WorkCycle.Net\logout.txt

Unit Testing

Create unit tests to execute your activity by adding Microsoft unit test project to your solution.

image18

image19

Populates fields added as specified in the options fields (outlined above).

image20

tells Workcycle what to use

image21

Runs the test

image22

Test and Run Activity

  1. Stop the workflow service.

  2. Update the PlugIn DLL.

    1. Copy the updated DLL from this location.

      image23

    2. Paste the updated DLL in this location.

      image24

    3. Restart the workflow service.

      image25

  3. New Activity will appear in the Activities Panel in the Workflow Designer.

    1. Create a workflow using the new Plugin (Activity).

      image26

    2. Create a workflow using the new Plugin (Activity).

  4. Drag the Activity to the canvas.

    image27

    image28

    image29

View Log

If logging is turned on, look at the messages in the log.

C:\Program Files (x86)\TMW Systems, Inc\WorkCycle.Net\logout.txt

This illustration represents a "fail" but shows the steps that were taken within the activity. It represents the last half of the messages that will appear.

image30