Creating a Command Custom Activity

You can create an activity based on a user-defined command. The following procedure creates an activity to execute a SQL query against a specific database as an example.

Procedure

  1. From your Workflow window in the Activities pane, click Create Activitycreate_activity_script_01.

    In the New Activity Type dialog box, the Command activity type is selected by default.

  2. Click OK.

  3. In the New Command Activity dialog box, click the General tab and provide the following general details:

    • For the Name property, enter the name of the activity, for example, SQLquery. This is the name you see in the Activities pane.

    • For the Description property, specify what the activity does.

    • For the Group property, select the activity group where you want to place the new activity, for example, Utilities. If you do not select a group, the new activity will be placed in the Ungrouped group.

  4. Click the Inputs tab to define the input variables that the activity will use.

    In our example, the SQLquery activity will need the following string variables to perform the query:

    • sqlServer, which will be the name of the client where the SQL Server resides

    • userName, which will the user account executing the SQL query

    • password, which will be password for the user account

    • database, which will be the name of the SQL database

    • query, which will be the actual SQL query

    To add the inputs follow these steps:

    1. Click Add.

    2. In the Add new property dialog box, enter the name of the variable in the Variable Name box, for example, sqlServer.

    3. Select string from the Variable Type list and click OK.

    If applicable, you can specify default value for the inputs in the Value column.

  5. Click the Definition tab to specify the command details. If you need to specify a variable that you created, click Insert Variable and select the variable from the list.

    Following our example, you can use this tab to specify the SQL query command details, as shown in the image below.

    create_activity_cmd_04

  6. Click OK.

    The new activity should be listed in the left pane under a specific activity group. You can drag the activity to the design area to start using it in your Workflow.

Loading...