DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Handle HL7 MLLP Messages With Mule 4
  • How to Use Mulesoft VM Connector
  • Step-by-Step Guide to Use Anypoint MQ: Part 1
  • Implementing and Deploying the Domain Project With MuleSoft

Trending

  • Implementing Explainable AI in CRM Using Stream Processing
  • Designing a Java Connector for Software Integrations
  • How To Build Resilient Microservices Using Circuit Breakers and Retries: A Developer’s Guide To Surviving
  • Securing the Future: Best Practices for Privacy and Data Governance in LLMOps
  1. DZone
  2. Software Design and Architecture
  3. Cloud Architecture
  4. How to Work With the ServiceNow Connector in MuleSoft

How to Work With the ServiceNow Connector in MuleSoft

Learn how to install and use the new connector for MuleSoft's Anypoint Studio and the ServiceNow enterprise cloud computing platform.

By 
Ashish Goyal user avatar
Ashish Goyal
·
Sep. 20, 17 · Tutorial
Likes (8)
Comment
Save
Tweet
Share
13.0K Views

Join the DZone community and get the full member experience.

Join For Free

ServiceNow and MuleSoft are working together to extend service management across the enterprise by fully integrating business processes such as ITSM, HR, legal, finance, procurement, operations, marketing, and facilities.
Image title
ServiceNow is a cloud computing platform that helps enterprises to move faster. With ServiceNow, enterprises can replace unstructured work patterns followed in the past with intelligent workflows in the future.

You get thousands of requests from customers, IT incidents, and HR cases on a day-to-day basis. They move on their own paths, moving to and fro between humans, machines, and different branches. They follow very unstructured and undocumented paths.

With ServiceNow Cloud platform, all employees and customers can make requests on a single cloud platform. Every branch or team working on these issues can prioritize, find the root cause of the issue, get real-time insight, and drive it towards real action to get results. It improves the service levels. ServiceNow is the faster way to get work done at lightspeed.

MuleSoft customers also use ServiceNow in various use cases. A customer uses ServiceNow to create and manage IT incidents. Some of the ServiceNow customers use ServiceNow for asset procurement, change management, access requests, incident management, and managing HR processes.

In this post, I’d like to walk you through a simple demo app to show you how to create an incident using ServiceNow connector in case you lose the access to VPN.

Before you start with the demo app, please make sure you have the ServiceNow Connector downloaded from the Exchange.

ServiceNow Connector on Exchange

After you install the ServiceNow Connector, create a new project in the Studio and name it serviceNowdemo. Please drag and drop the connectors as shown in the below flow:

Image title

Once you have all the pallets, configure the connector. To configure the ServiceNow Connector, you need to have an account with ServiceNow. You can create a developer's account with ServiceNow on developers.servicenow.com. It's free. Once your account is created, you can go to the "Manage > Instance" option to see the instance allocated to you from ServiceNow.

Image title

You will need the username, password, URL, and ServiceNow version of this instance to configure ServiceNow Connector. Keep these details handy to configure on your ServiceNow connector. You can see the below snapshot for my configurations:Image title

HTTP Listener is the first component of my Mule flow. For HTTP Listener, I am using port 8091 and the path as "/createIncident."  

For the Transform Message component, Mule will sense the data for the configuration you will select on the ServiceNow connector and populate the output for the columns of the table. Mule uses Data Sense when we use Transform Message anywhere in the flow. For this demo, I have selected the Incident table and Insert operation in ServiceNow Connector as shown in the below snapshot:

Image title

Transform Message will be auto-populated with all of the fields of the Incident table. This is really wonderful:

Image title

We will use DataWeave to map some of these fields in Transform Message. For this demo, I am using the below DataWeave code:

%dw 1.0
%output application/xml
%namespace ns0 http://www.service-now.com/incident
---
{
  ns0#insert: {
    comments: "This is very urgent. Please resolve it quickly",
    short_description: "Cannot Access the VPN",
    state: "New"
  }
}

This is just for this demo. You can add more fields based on your experience with ServiceNow. You have to go through some of the documentation of ServiceNow to understand the purpose of the other fields in the table. If you want to use the connector to manage the HR operations or procurement, you have to select a different table and operation and configure the Transform Message component accordingly. 

In my second Transform Message component, I am providing the payload with an output as application/JSON:Image title

%dw 1.0
%output application/json
---
payload

This transformation is done to log the payload for tracking purposes in this demo. You can use the payload returned from ServiceNow to send the incident details to the users. 

As we have configured all components, our app is ready to be deployed and tested. Just run it and deploy it on your Mule Runtime env. 

Now, your app is ready to create an Incident through ServiceNow. If you open your browser and hit http://localhost:8091/createIncident, you will see the following page.

You will also get a similar response on the browser :

Image title

This will create an Incident in ServiceNow portal under the Incidents page. 

You need to browse through your ServiceNow instance https://dev37944.service-now.com/ (this is my ServiceNow instance). Please go to your ServiceNow instance to access the incidents.

Image title

Click on "incident" and Select "ALL" options on the incident page. It will show all incidents created on this instance. You have to filter based on your incident number. 

Image title

You can see that the incident has been successfully created. You can click on the incident number and check the details are same as provided in your Mule app. Image title

Image title

We have provided these details in the Transform Message component while writing the DataWeave. 

We can see all details related to the creation of the incident have flown from Mule to ServiceNow.

This was a very basic use case of ServiceNow Connector. For new users, try the above example to get started, and for others, please share with us how you are planning to use ServiceNow with the Anypoint Connector! Also, explore the Anypoint Exchange to see other resources you can leverage today.

Connector (mathematics) MuleSoft Cloud computing Database app Use case Requests Payload (computing) Flow (web browser)

Opinions expressed by DZone contributors are their own.

Related

  • Handle HL7 MLLP Messages With Mule 4
  • How to Use Mulesoft VM Connector
  • Step-by-Step Guide to Use Anypoint MQ: Part 1
  • Implementing and Deploying the Domain Project With MuleSoft

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!