Create custom activities

From the Custom tab, you can create and update custom activities without leaving the workflow editor.

Before you begin

Roles required: admin, workflow_admin, activity_creator

About this task

Custom activities can:
  • Share data between activities in a workflow.
  • Parse data from standard input formats.
  • Be purchased from and shared on the ServiceNow Store.
  • Be versioned.
  • Be copied.
Note: The information displayed in the Custom tab depends on the current view in the workflow editor. When you display a workflow on the canvas, the Custom tab shows all available custom activities categorized by application, but does not display any input or output data.

Procedure

  1. Click the + icon to create a new activity and select the appropriate template from the list.
    The Activity Designer form appears, with a stage indicator at the top. All new activities start at the General stage. The current stage is indicated by a blue underscore.
    Figure 1. Activity designer stage indicator
    Activity designer stage indicator
  2. Enter a name for your activity and click Continue.
    This action saves the activity and opens the Inputs form.
  3. Create the input variables for your activity.
    For additional information about configuring variables in custom activities, see Activity designer variables and Orchestration activity parsing rules.
  4. Proceed to the next stage by taking one of these actions:
    • Click Continue to open the Execution Command form and map the variables to input fields. To save the activity from this point on, you must click Save.
    • Click Go to Pre-Processing (Advanced) to create a pre-processing script. If you create a script, Orchestration adds this step to the indicator.
  5. In the Execution Command form, map the input variables by dragging and dropping them into the activity's input fields.
    Figure 2. Mapping input variables
    Mapping input variables
  6. Complete the other fields and click Continue.
  7. In the Outputs form, create the output variables and map them to the output fields by dragging and dropping the variables into the parsing rules structure.
    Figure 3. Output field mapping
    Output field mapping
  8. Proceed to the next stage by taking one of these actions:
    • Click Continue to open the Conditions form.
    • Click Go to Post-Processing (Advanced) to create a post-processing script. If you create a script, Orchestration adds this stage to the indicator.
  9. Create exit conditions for your activity and click Save.

Publish a custom activity

When a user creates a custom activity and saves or submits it, that activity appears in the Custom and Packs tabs of the designer palette, but is visible only to the user who created it.

Before you begin

Roles required: admin, activity_admin, activity_creator

Procedure

  1. When you finish configuring the activity, click Publish.

    This makes the activity accessible to other users on the instance with the workflow_admin or activity_creator role. Published activities are available for upload to the ServiceNow Store, can be added to workflows, and can be edited by any user with the proper roles.

  2. To edit a published activity, click Checkout.

    When an activity is checked out by a user, only that user can modify it. The fields of a checked out activity are read-only for all other users.

  3. When you are finished editing the checked out activity, publish it again.
    The system adds a new version of this activity to the Custom tab in the workflow editor palette.
    Note: Activities you create and publish are visible in the Packs tab only if they were created in the current application scope.

Return a locked activity to a published state

Problems can arise if an activity version is checked out by a user and not checked back in. An activity in this state cannot be checked out for update.

Before you begin

Role required: admin, activity_admin, activity_creator

About this task

An administrator can return a locked activity to a published state.

Procedure

  1. Open the workflow editor.
  2. From the Custom tab, open the activity that is locked.
  3. Click the menu icon in the title bar and select Versions from the context menu.

    A list of all the versions of that activity appears. The locked version displays the user who checked it out.

    The version history displays information about who checked out the activity
  4. Select the checked out version.

    The system opens the record in the activity designer.

  5. Click the menu icon again and select Force Checkout from the context menu.

    The activity fields become editable.

  6. Click Publish.

    The activity becomes available to users with the appropriate roles.

Copy a custom activity

You can copy activities for reuse from the Custom tab in the global scope.

Before you begin

Role required: admin, activity_admin, activity_creator

About this task

Note: You cannot copy an activity in a private scope.

Procedure

  1. To reuse an activity in the global scope, expand the parent category to display the activities.
  2. Right-click the activity you want to copy and select one of these options:
    • Copy into global scope as new activity: Copies the activity with the new name you provide, uses the same version number as the original activity, and moves it to the global scope in the Custom tab.
      Figure 4. Naming an activity copy
      Naming an activity copy
    • Copy into global scope as new version: Copies the activity using the same name, increments the version number, and moves it to the global scope in the Custom tab. The system automatically adds the parent category to the Custom tab if it does not already exist. This action will overwrite another activity with the same name and version number.
      Figure 5. Creating a new activity version
      Creating a new activity version
    Note: If the activity is in any other scope but global, the system displays this message: Cannot copy privately scoped activity.