Travel Compensation : JavaScript Extensions

Many of our readers will be familiar with the Example Projects (which include Travel Compensation)  that are provided with the download of Oracle Policy Modeler. If you are not, they are accessible here:

OPA 12 - Travel Compensation Example Access

If you are not familiar with them, we encourage you to dive right in and to find out about all the wonderful examples you can find in there. It is a great learning tool and a good way to discover potential use cases. One of the more famous ones is the Project related to the legislation relating to Travel Compensation by Airlines, in the European Union (EU261/2004), mentioned above.

This allows the traveler to receive a compensation amount when their flight is delayed or they are refused boarding (among various criteria)  if the flight meets certain conditions (there are various exclusions for territories such as Gibraltar and so on).

The Project

The provided example Project has a number of key learning points :

  1. The project has multiple translation files
  2. The project is mapped to a RightNow Connection
  3. The project uses the CurrentLocale() functions introduced in 18C
  4. It uses a number of Excel tables to maintain static data.
  5. It links to various websites for example to calculate distances.

The existence of Translation files is a good chance for new started to discover how multiple interfaces are built inside Oracle Policy Automation 12, and the mapping to RightNow has two side effects (even if you do not have access to the RightNow instance specified in the Connection).

OPA 12 - Travel Compensation Example RightNow Dialog

Firstly if you have never seen the RightNow-specific (as opposed to the generic Web Service Connection dialog) window, it can come as a bit of a shock. If you need a primer as to what the different icons mean, you can check out our series about Service Cloud (RightNow) and OPA. The second side effect is the long set of Value Lists that are drawn down from Service Cloud as part of the Connection (even if they are not being used here).

OPA 12 - Travel Compensation Example Value Lists

We mentioned the arrival of locale-detection functions in our What’s New post a few weeks ago. The two most interesting things, and the point of this post, is the fact that Excel is used to store static data (in the case below, airline names and countries)

OPA 12 - Travel Compensation Example Excel Sheet

and that some of the information to be entered is referenced using URLs : in the case below, the need to calculate a distance between two airports:

JavaScript Extensions : Airports, Airlines and Great Circle Mapping for Travel Compensation

In the example Project, the focus is on a clear definition of the Policy and a demonstration of how to implement a good design pattern. But the end user experience suffers a bit – this is not a criticism, since it obviously was not the learning focus – because of the kind of data to be entered.

Take for example the first screen, where we enter our journey details : departure and arrival airports. Given that the airport information is extremely useful (namely, every airport has an ICAO code, and a latitude and longitude), we are going to use a custom Search to let the user find the airport and we will capture some extra information : the Country and the ICAO code. The Country is used later in the rules, and the ICAO code will come in very handy in a moment.

OPA 12 - Travel Compensation JavaScript Search Extension Airports

We’ve actually two versions. The first version uses a website called : they have a variety of free (registration required) web services for searching for places including airports. It does not have ICAO codes but has a lot of other information. The second version uses a freemium web service from which includes an airport search which additionally returns an ICAO code. Both of them return the Country.

A later page asks for the name of the Airline : again we decided to use a custom Search, from a website called which has a variety of web services including an Airline lookup which includes the operating country (which is referenced in the rules).

OPA 12 - Travel Compensation JavaScript Search Extension Airlines

Finally, the legislation bases compensation in part on the kilometer distance of the flight. It must be calculated using the Great Circle method according to the law, this method takes into account the curvature of the earth. We returned to the freemium web service listed above to take advantage of the airport to airport Great Circle mapping Web Service, which also can return duration (based on a supplied average airspeed) and many other nuggets of information.

OPA 12 - Travel Compensation JavaScript Label Extension Distance

For the above example we use a custom Label (which is not displayed) which drops the calculation into the Input box so the user can adjust it if required (but our tests proved it to be very accurate indeed).

As such, these three extensions increase the data entry speed and make the process much simpler. So there you have it, some examples of useful JavaScript extensions. The Project now looks like this:


You can find them in the Online Store as usual, search for Travel Compensation. Don’t forget the official Oracle Policy Automation Developer Guide Interview Extensions Reference.

More on similar topics:

Author: Richard Napier

After 8 years in case management and ERP software roles, Richard Napier joined Siebel Systems in 1999 and took up the role of managing the nascent Siebel University in Southern Europe. He subsequently was Director of Business Development and Education for InFact Group (now part of Business & Decisions) for 8 years. He now runs Intelligent Advisor IT Consulting OÜ. Owner of, he also is Co-Founder of the Siebel Hub.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Intelligent Advisor IT Consulting Serving Customers Worldwide
Hide picture