Create a run script activity

Use these instructions to create a custom Run Script Orchestration activity.

Before you begin

Role required: activity_creator or workflow_admin

About this task

For instructions on using the activity template process flow, see Create custom activities

Procedure

  1. Navigate to Workflow > Workflow Editor.
  2. In the workflow palette, select the Custom tab.
  3. Click the +icon.
  4. Select the Run Script template.
    Activity template selection
  5. Complete the fields shown in the table.
    Table 1. Fields common to all activity designer templates
    Fields Description
    Name Descriptive name of the activity. Select a unique name that makes the activity easily identifiable in the palette. If you do not name the activity, it is identified in the Data tab of the workflow editor with an index number when it is added to a workflow. This index reflects the order in which the custom activity was added to the workflow. Only custom activities and their output variables appear in the Data tab.
    Short description Brief description of what the activity does.
    Image Icon that identifies an activity of this type in the workflow palette.
    Protection policy Setting that controls access to the code in the Pre Processing and Post Processing script fields of this activity. Use these settings to protect your intellectual property:
    • None: Script is unprotected.
    • Read-only: Script is in plain text, but read-only.
    • Protected: Script is encrypted and read-only.
    Important: Make sure to set this field properly before submitting the record. After you save the activity, this field becomes read-only.
    Execution template Predefined template selected for this activity.
    Application Current scope set on the instance. To view the scope, click the gear icon on the right side of the title bar in any record or list and look at the value in the Application field. The activity runs in this scope within a workflow. You cannot view or change the scope for the instance in the workflow editor.
    Accessible from Accessibility setting for this activity, by scope. The following options are available:
    • All application scopes: This activity is available to all application scopes.
    • This application scope only: Use of this activity is restricted to the scope named in the Application field.
    Category Category for this activity in the Custom and Packs tabs. All categories are listed under their scope in the collapsible hierarchy.
    Description Detailed description of the activity.
  6. Use the variable builder in the Inputs tab to create variables to pass into the script that the activity runs.
    For more information, see Map an input variable.
    Run Script custom activity Inputs tab
  7. Create variables in the Outputs tab that contain values returned from the execution script that are available to other activities in a workflow.

    For more information, see Activity designer variables.

  8. Create a script for this activity to execute.

    You can access the activityInput and activityOutput variables by using activityInput.variableName and activityOutput.variableName, respectively.

Create Run Script template input variables

Create the variables to pass into the Run Script activity in the Inputs form of the activity designer.

Before you begin

You must name your activity in the General form before you can advance to the Inputs stage.

Roles required: activity_admin, activity_creator

Note: Variable strings in the Inputs form have a 255 character limit.

Procedure

  1. Click the + icon to create a new input variable.

    The designer creates a default variable called Input1.

    Creating an input variable
  2. Type your new variable name in the field.
  3. To change the name of a variable or any of its attributes, double-click the value and then select or enter a new value in the field that appears.
  4. Configure your variable using these fields:
    Table 2. Variable configuration
    Field Description
    Type Data type for this variable. Double-click on the field to display the choice list. In addition to the usual data types, you can create input arrays and encrypt individual variables that contain sensitive data. Encrypted variables are passed to the ECC Queue and then decrypted by the MID Server when they run on the target host. Sensitive data returned from running these variables on the host can then be passed to another activity through encrypted output variables.
    Mandatory Marks an input variable as mandatory. Variables marked as mandatory are required fields in the properties form for the activity in the workflow. The input testing feature allows you to filter on mandatory variables.
    Default Default value for this input variable. Default values are prepopulated for variables in the properties form for the activity in the workflow. You can override this value when you test the variables.
  5. To reorder the variable list, select a row and then drag the row to its new location.

    When you select a row to move it, the pointer icon changes to an up/down arrow icon ().

  6. To delete a variable, click the delete icon () in the row.
  7. Click Continue to advance to the Outputs stage.

Run Script output variables

For details about creating data structures using output variables, see Activity designer variables. These variables can be mapped to all or part of the data returned from a selected payload. For details about mapping output variables to payload data, see Orchestration activity parsing rules.

Table 3. Activity designer output fields
Field Description
Variable name Name of an output variable that this activity passes.
Output Variable that contains a value that is passed to other activities in the workflow.

Run Script template processing script

Table 4. Run Script processing script
Field Description
Processing script Script that the activity runs.
Variables Input variables that are available to use as building blocks in the input process script. Click the arrow above the field to open the variables list. Click an item in the tree to add it to your script in the appropriate syntax. The list displays input variables you passed into the activity on the Inputs form. All activity variables added in the Inputs form are read-only and are expressed in the processing script with this syntax: activityInput.variable.

Run Script template conditions

Create the exit conditions for your activity in the Condition column and set the order for each.

The system evaluates the condition with the lowest order number first and stops when it finds the first true condition. The system delays evaluation of conditions with an Else value set to true until all conditions with an Else value set to false are evaluated. If the system does not find a true condition, it looks for a default condition in which the value for Else is true and takes this exit. You must have at least one default exit condition, or the activity hangs when the workflow runs.

The following are possible conditions you might create for an activity:

Table 5. Sample activity conditions
Condition Evaluation
Success Tests for a success condition. Else is set to false and the Order is set to 100. If this condition is true, the activity takes the Success exit. If this condition is false, the system evaluates the next condition in order.
Retry Tests for a condition that runs the activity again. Else is set to false. If this condition is true, the activity runs again. If this condition is false, the system takes the default Failure exit.
Failure Default condition that allows the workflow to continue if the other conditions in the activity are false. Else is set to true.
Sample activity conditions