Thank you for your feedback.
Form temporarily unavailable. Please try again or contact to submit your comments.
  • London
  • Kingston
  • Jakarta
  • Istanbul
  • Helsinki
  • Geneva
  • Store

Customize pattern operations

Customize pattern operations

As part of creating or modifying a discovery pattern, modify existing custom operations that come as part of the base system or add new ones.

Before you begin

Practical knowledge of Java scripting is required.

Role required: pd_admin

About this task

For standard pattern operations, you can define only input parameters. However, there are custom operations for which you can define the business logic and the mechanism of the operation itself in addition to input parameters. For example, you can make a parameter mandatory or define which input parameters to use.

The following custom operations are available:
Cloud REST Call
Extracts information from configuration items of the PaaS (Platform-as-a-Service) type, such as Microsoft Azure or Amazon Web Services. This Java-based custom operation is part of the base system.
HTTP Get Call
Extracts information from configuration items (CIs), which use the HTTP protocol. This custom operation is part of the base system.
Cloud REST Query
Extracts information from configuration items of the PaaS (Platform-as-a-Service) type, such as Microsoft Azure or Amazon Web Services. This Java-script based custom operation is available only after downloading patterns version 1.0.24 or later from ServiceNow Store. Use this operation instead of the Cloud REST Call operation.

In addition to these custom operations, you can create your own operations to serve the needs of your discovery process. Custom operations created by you appear in the list of operations along with operations, which are part of the base system.


  1. Navigate to Pattern Designer > Custom Operations.
  2. To add a custom operation, click New.
  3. To modify an existing custom operation, click its name in the table.
  4. For the new custom operation, enter a name describing the new operation in the Name field.
    For example, if the purpose of this operation is to extract information using a certain protocol, you can name it NetApp protocol query.
  5. Enter or modify the operation purpose or description in the Description field.
  6. Write the Java script in the Script pane to define the business logic of the operation.
    The script must comply to the following guidelines:
    • Create variables for operation parameters using the dollar sign in front of the variable name, for example, $fileName.
    • CTX is an object containing all the information which resulted from a pattern execution.
    • Use rtrn to indicate the string, which is the result of your custom operation.
    For example:'message from Custom operation MIDLogWrite ' + $logMessage);
    Where is the MID Server log. The $logMessage variable refers to the message that is created inside this MID Server log.
  7. In the Custom Operation Parameters related list, define the input parameters you used in the Java script.

    For example, if you used a variable for the log message file in the Java script, you must also define the parameter for this variable:

    Define parameters for variables used in the script.
    Field Description
    Label Enter a short and descriptive label for the parameter. The label shows in the table. For example, netapp_query.
    Name Enter a short and clear name for the parameter without spaces, for example, NetAppquery. This name appears in the list of operations on the pattern step page.
    Default value If relevant, enter the default value. For example, POST.
    Mandatory Set to true if this parameter is mandatory for this operation.

    Otherwise, set to false.

    Order Define the order in which parameters appear on the operation page. Use natural numbers, where 1 means this parameter appears at the top of the operation page.
    Domain For domain-separated environments, specify the name of the domain for which this parameter is relevant.
    Validation Regex Specify a Java regular expression to validate the parameter with. During discovery process, the MID Server validates the operation result. The Pattern Designer module also runs validation when you click Test on the pattern step page.

Updates to site content will be made starting around 4am on January 17th (Pacific Time) and lasting approximately 6 hours.  This site may be intermittently unavailable.