Contact Us 1-800-596-4880

ServiceNow Connector - Mule 3

ServiceNow Connector v4.0

Anypoint Connector for ServiceNow (ServiceNow Connector) facilitates connections between Mule runtime engine (Mule) integration and ServiceNow applications for ServiceNow Connector 4.0 and later. The ServiceNow connector currently provides access to standard tables in the ServiceNow database, enabling you to perform Insert, Delete Record, Delete Multiple, Update, Get, Get Keys, and Get Record operations on them.

Before You Begin

You are familiar with ServiceNow, Mule runtime engine, Anypoint Connectors, and the Anypoint Studio interface. To increase your familiarity with Studio, consider completing one or more Anypoint Studio Tutorials. Further, you have a basic understanding of Mule flows and Mule Global Elements.

This document describes implementation examples within the context of Anypoint Studio, Mule’s graphical user interface, and, also includes configuration details for doing the same in the XML Editor.

If you don’t use Anypoint Studio for development, follow the instructions to install the ServiceNow Maven dependencies into your pom.xml file.

For ServiceNow connector v4.0 to function properly, the namespace for locally declared elements must be qualified by the target namespace. Make the following change in your ServiceNow instance to do so:

  1. Go to System Properties > Web Services

  2. Click Properties

  3. De-select the YES|NO box for the elementFormDefault property as shown below.

    snow screen

Note that the box is selected by default, setting the elementFormDefault property to true. By de-selecting the box, we set the property to false thereby specifying that locally declared elements must be qualified by the target namespace.

Install the Connector

  1. In Anypoint Studio, click the Exchange icon in the Studio taskbar.

  2. Sign in to Exchange with your Anypoint Platform credentials.

  3. From Anypoint Exchange, click Provided by MuleSoft.

  4. Search for the Mule 3 connector and click Install.

When Studio has an update, a message displays in the lower right corner, which you can click to install the update.

To use the ServiceNow connector in a production environment, you must have either:

  • An Enterprise license to use Mule

  • A CloudHub Starter, Professional, or Enterprise account

Contact the MuleSoft Sales Team to obtain either of these. (Read more about Installing an Enterprise License.)

Configuration Using Anypoint Studio

To use the ServiceNow connector in your Mule application, configure:

  • If needed, a global ServiceNow element to be used by all the ServiceNow connectors in the application.

  • Parameters of each ServiceNow connector instance in the flow.

Configure a Global Element

Follow these steps to create a global ServiceNow configuration in a Mule application:

  1. Click the Global Elements tab at the base of the canvas, then click Create.

  2. In the Choose Global Type wizard, use the filter to locate and select ServiceNow, and click OK.

  3. Configure the parameters:

    serviceNowge
    Field Description

    Name

    Enter a name for the configuration so it can be referenced later.

    Username

    Username for connecting to the ServiceNow instance

    Password

    Password to log into the ServiceNow instance

    Service Endpoint

    The URL of the ServiceNow instance.
    Format:` https://<instancename>.service-now.com`

  4. Access the Pooling Profile tab to configure any settings relevant to managing multiple connections via a connection pool.

  5. Access the Reconnection tab to configure any settings relevant to reconnection strategies that Mule should execute if it loses its connection to ServiceNow.

  6. Click OK to save the global connector configurations.

  7. Return to the Message Flow tab in Studio.

Configure Connector Properties

Follow these steps to configure the parameters of a ServiceNow connector in the flow:

  1. Drag the ServiceNow connector onto the canvas, then select it to open the properties editor.

  2. Configure the connector’s parameters according to the table below.

    Field Description

    Display Name

    Enter a unique label for the connector in your application.

    Connector Configuration

    Connect to a global element linked to this connector. Global elements encapsulate reusable data about the connection to the target resource or service. Select the global ServiceNow connector element that you just created.

    Operation

    Select the action this component must perform: Insert, Delete Record, Delete Multiple, Update, Get, Get Keys, and Get Record.

    Type

    Select the ServiceNow table to act upon. For a complete list, see the ServiceNow Release Notes.

    <Operation> Request

    From Message: Select this option to define the operation based on the incoming payload.
    Create Object manually: Select this option to define the search values manually. Mule provides an editor to facilitate this task.

  3. Save your configurations.

Configuration from the XML Editor

  1. To use the ServiceNow connector in your Mule application, configure:

    • If needed, a global ServiceNow element to be used by all the ServiceNow connectors in the application.

    • Parameters of each ServiceNow connector instance in the flow.

  2. Ensure that you have included the ServiceNow namespaces in your configuration file.

    http://www.mulesoft.org/schema/mule/servicenow
    http://www.mulesoft.org/schema/mule/servicenow/current/mule-servicenow.xsd
  3. Create a global ServiceNow configuration outside and above your flows, using the following global configuration code.

    <servicenow:config name="ServiceNow" username="YOUR_USERNAME" password="YOUR_PASSWORD" serviceEndpoint="YOUR_SERVICENOW_URI"/>
    Attribute Description

    name

    Enter a name for the configuration so it can be referenced from within the flow.

    username

    Username for connecting to the ServiceNow instance.

    password

    Password to log into the ServiceNow instance.

    serviceEndpoint

    The URL of the ServiceNow instance.
    Format: https://<instancename>.service-now.com

  4. Build your application flow, then add a ServiceNow connector using one of the following operations.

    Operation Description

    <servicenow:delete-multiple>

    Delete multiple records from the targeted table by example values.

    <servicenow:delete-record>

    Delete a record from the targeted table by supplying its sys_id.

    <servicenow:get>

    Query a single record from the targeted table by sys_id and return the record and its fields.

    <servicenow:get-keys>

    Query the targeted table by example values and return a comma delimited list of sys_id.

    <servicenow:get-records>

    Query the targeted table by example values and return all matching records and their fields.

    <servicenow:insert>

    Creates a new record for the targeted table.

    <servicenow:update>

    Updates a existing record in the targeted table in the URL, identified by the mandatory sys_id field.

    Follow the links in the table above to access detailed configuration reference for each of these operations.

View on GitHub