Retrieve Records From A ServiceNow Incident Table Using MuleSoft

Author: Sweta Kumari

The ServiceNow Connector in MuleSoft provides the following different kinds of operations for users:

  1. Invoke
  2. New/Updated Record
  3. Unauthorize
  1. Invoke:

This is the default operation of the ServiceNow connector. We can use this connector for various functions, such as creating, updating, retrieving, and deleting records in any table present in ServiceNow.

  1. New/Updated Record:

This operation is used to fetch newly created records from a selected table in ServiceNow on a scheduled basis. The scheduler can run on a fixed frequency or a cron expression.

  1. Unauthorize: 

This operation deletes all the information of the access token for a given owner ID. As a result, it becomes impossible to execute any kind of operation for the user. The user needs to perform an OAuth dance once again to resume operations.

In this article, we will retrieve the records from a ServiceNow Incident table.

Follow the steps given below to create a Mule app for using ServiceNow to retrieve records:

  1. Create a new developer account at
  2. Request a developer instance.
  3. Select a developer instance. I will be using the “Tokyo” instance for this POC.
  4. You will be given a username, i.e., admin, and password at this stage. Alternatively, you can fetch your instance password using the “Manage Instance Password” option.

The example given below creates a flow in Mule Studio that will retrieve records from the Incident table in ServiceNow. The screenshot below shows the Studio app flow as an example:

Steps for creating a Mule application:
  • Create a new Mule project.
  • Add and configure an HTTP Listener.
  • Add a Transform Message after the HTTP connector and write the payload as given below: 

Please note: Add the description that matches the records in the ServiceNow incident table.

  • Use the Invoke operation from the ServiceNow component after the Transform Message step.
  • Add details of the ServiceNow configuration. If the connection is not successful, please correct the parameters and test again.
  • Choose ‘incident’ as the service and ‘getRecords’ as the operation.
  • Set the Message Body as the payload.
  • Add a Transform Message component to transform the output XML to JSON.
  • Add a logger at the end of the flow that takes the payload as the message.
  • Run the application.
  • Test the application.
  • The response will look similar to the example given below.

Note: For inserting/creating records in ServiceNow, you can follow the blog

Happy Learning!

We use cookies on this site to enhance your user experience. For a complete overview of how we use cookies, please see our privacy policy.