Creating an XML Operation Custom Activity

Updated

You can create an activity based on a user-defined XML operation. The following procedure creates an activity that creates a user.

Procedure

  1. From your Workflow window, click Create Activitycreate_activity_script_01.

  2. In the New Activity Type dialog box, select XML Operation from the Activity Type list and click OK.

  3. In the New Operation 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, CreateUser. This is the name you will 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 CreateUser activity will need the following string variables to perform the query:

    • username, the name of the user account to be created

    • password, the password for the user account

    • fullname, the full name of the user for whom the account is being created

    • email, the email account for the user account being created

    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, CreateUser.

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

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

  5. Click the XML Input tab to specify the XML document details. If you need to specify a workflow variable or a variable that you created, click Insert Variable and select the variable from the list. Click OK.

  6. Click the Script tab to specify the Java or JavaScript code which this activity will perform.

    Following our example, the code will retrieve the output of the XML request. You can use this output perform any sort of data manipulation that you require.

  7. Click the Outputs tab to retrieve the output from the XML operation activity. You can set the xpath statements directly in the value of the output. Click OK.

    create_activity_xml_06

  8. 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.

Was this page helpful?