Using flint to orchestrate BMC Remedy
BMCs Remedy ITSM platform is one of the most commonly used and mature Service Management Systems - but automating it can be tough.
In our previous blog post we got you started with flint’s orchestration platform. In this post we’ll show you how to query Remedy Forms, how to handle the response, how to create new records or how to update existing ones.
Let’s take a typical integration use case: An external system is called on a regular base. Depending on the response, new records are created in Remedy or existing records are updated.
In our example we have a custom build Remedy Application. This application requires up-to-date exchange rates between EUR and USD. We’ll poll an external Webservice to get the current exchange rate and we’ll store them in a Custom Remedy Interface Form. We’ll check the form for existing records and update them if necessary.
Prerequisites
To get this example running you need a BMC Remedy Server and a running copy of Flint. You’ll also need:
AR Restful API — A Restful API wrapper around the BMC Remedy Java API. For a quick start just run:
docker run -d -p 8080:8080 vipcon/arapi
on your docker environment. This will pull the latest Version from Docker Hub and deploy it in your environment.
Remedy Toolkit — Our Remedy Toolkit wraps up the AR Restful API calls and provides some basic call handling.
Exchange Rate Webservice — We’ll also make use of the Exchange Rate Webservice provided by Fixer.
Flint Configuration
In our example we’ll use two different HTTP connectors. One for the Remedy connection and one for the Exchange Rate WebService call. You can get away with only one, but using two will give you more control about scalability and security.
You can configure the following values:
- arapi — The URL of your AR Restful API
- connector — The name of the HTTP Connector that should be used
- username — The Login ID of the Remedy User
- password — The password of the Remedy User
- port — The port of the Remedy Server (enter 0 for Portmapper)
- server — The name or IP of the BMC Remedy AR Server
The Code / Workflow
For our interface we’ll just need a simple Flintbit to query the Webservice and update the interface form.
First we’ll get the current Exchange rates from Fixer:
def exchangeResponse=call.connector("Fixer")
.set("method","get")
.set("url",url)
.set("timeout",15000)
.sync()
Based on the Run Date we can check the Remedy Interface form for existing records:
def query = "'Run Date' = \"${runDate}\""
def queryResponse = call.bit("remedy:base:query.groovy")
.set("form",interfaceForm)
.set("query", query)
.sync()
If we find existing entries, we’ll update all of them:
queryResponse.data.each { myRecord ->
log.debug "Update " + myRecord.getKey()
def recordData = "{ \"${myRecord.getKey()}\": { \"Currency\": \"EUR -> USD\", \"Exchange Rate\":" + rate + ", \"Run Date\" : \"${runDate}\" } }"
def updateResponse = call.bit("remedy:base:update.groovy")
.set("form",interfaceForm)
.set("data", recordData)
.async()
}
If we didn’t find any existing records we’ll create a new one:
def recordData = "{ \"MyRefId01\": { \"Currency\": \"EUR -> USD\", \"Exchange Rate\":" + rate + ", \"Run Date\" : \"${runDate}\" } }"
def createResponse = call.bit("remedy:base:create.groovy")
.set("form",interfaceForm)
.set("data", recordData)
.sync()
The full code is available on GitHub.
Scheduling the Integration
To make sure that we’ll always have the latest data, we’ll let our integration run every hour. To do this we just need to place a schedules.conf in our FlintBox:
"my-schedule" {
description = "runs our integration every hour"
trigger = "ars:remedy.groovy"
cron = "0 0 0/1 1/1 * ? *"
enable = false
input {
}
}
Conclusion
Integrating an external system into BMC Remedy is simple and fast forward with flint. Using an orchestration tool like Flint makes developing integrations a lot faster and easier. For a simple interface like this you now only need a few lines of code.