Creating Custom Activities

Before creating custom activities, consider the following:

  • Process definitions referenced by a custom activity are referenced by name. You should develop a convention that ensures uniqueness of process definition names, such as storing process definitions in nested folders similar to Java package names (for example, com/myCompany/Payroll). This convention helps to avoid naming conflicts with other packaged process definitions that are either created by other groups in your organization or purchased through a third-party.

  • The Start activity for a process definition can optionally specify an input schema. This input schema of the referenced process definition is displayed as the input for the custom activity. This schema must contain all information required by the process.

  • Only processes that do not have process starters (that is, they begin with the Start activity) can be referenced by a custom activity.

  • You may wish to use global variables within process definitions that will be stored in a custom activity. Global variables required by the custom activity are automatically added to the global variable list of the project when the activity is added to a process definition. You should document the required global variables and appropriate values for the variables for users of your custom activities. Also, you should develop a naming scheme for global variables used in your custom activities so that they are unique and do not conflict with other global variables.

  • WSDL files or XSD schemas referenced by a process definition are not included when the process definition is placed in a custom activity. You must make WSDL files and XSDs available to any users of your custom activity. These can be imported into a project by the user of the custom activity.

To create a custom activity, perform the following procedure:

Procedure 

  1. Drag and drop a folder from the General palette to the design panel. Specify a name for the folder.

    Note: It is not required, but it is strongly recommended that you place process definitions into uniquely named folders, or create a folder hierarchy to hold your process definitions. This helps to ensure that the names of process definitions referenced by custom activities will not conflict with each other.
  2. Drag and drop a Process Definition resource from the Process palette to the folder you created in Step 1. This process definition defines the business logic you are encapsulating in a custom activity.

  3. Optionally, specify an output schema in the Start activity of the process definition. This schema should contain any input you expect users to pass into the custom process.

  4. Add activities and transitions to define the business logic for this process.

  5. Optionally, specify an input schema for the End activity of the process definition. Map process data into the elements of the input schema. This schema will contain the output data that is available after the custom activity executes.

  6. In the project panel, click on the root node of the project, then select the General Activities palette in the palette panel.

  7. Drag and drop a Custom Activity resource into the design panel.

  8. Specify a name, and optionally specify a custom icon for the custom activity on the Configuration tab of the Custom Activity resource.

  9. Click the Browse button in the Select Process field and locate the process definition you created in steps 2 through 5 above.

  10. Click Apply.

Note: Any resources referenced by the process definition in a custom activity are automatically included in the custom activity. For example, your process definition may call other sub-processes or it may reference shared configuration resources. All the referenced resources will be encapsulated in the custom activity along with the specified process definition. Dynamically called subprocesses are not known at design time, and therefore are not referenced by the process definition. Therefore, dynamically called subprocesses cannot be used by a process definition within a custom activity.