Free MuleSoft CONNECT Keynote & Expo Pass Available!

Register now+
Nav

Example: To Get ServiceNow Incident Table Keys

This example creates a Mule flow to get keys from the Incident table in a ServiceNow instance. It is a simple configuration that assumes the default HTTP request configuration and sets properties for the HTTP connection: socket properties, proxy settings, and authentication. To employ a different authentication strategy, you can use advanced configuration settings.

  1. Create a Mule application as a project in Design Center or Studio 7.

  2. Add and configure HTTP Listener trigger for your flow using a Path such as this one:

    /incident/get

    You can use the default ServiceNow configuration for the Listener connection.

  3. [Optional] To test your credentials to the ServiceNow server, configure a new HTTP Request component with BASIC Auth along with your username and password.

  4. Add a Transform (or Transform Message) component after the HTTP component, and set the value to:

  5. Add a Transform component after the HTTP connector, and provide a transformation script something like this:

    output application/json
    ---
    ['description': 'Get Keys Demo']

    Notice that the script transforms the output to JSON from the XML input.

  6. Add the Invoke operation from the ServiceNow connector after the Transform component.

    • Set up, test, and save a ServiceNow configuration for the connection to the ServiceNow server.

      If the connection is unsuccessful, you should correct any invalid connection parameters, and test again.

    • In the General side-tab, set Service to incident and the Operation to getKeys, for example:

      servicenow-getkeys-config

  7. Add a Logger to the end of your flow that takes a payload (or #[payload]) as the message.

  8. Deploy or Run your app.

  9. To test the app, navigate to http://localhost:8081/incident/get

In this topic: