Tag: Oracle Policy Modeler

Extension Code Generators for JavaScript

Extension Code Generators for JavaScript

Over on my other home (https://siebelhub.com) we use and promote the use of Code Generators : because most of the JavaScript people need to create is in fact very structured, because of the underlying extension architecture. You don’t write just any code, you write code the way you have to write it. So how to write Extension Code?

[Update 1 November 2018 : I added fullCustomInput as an option. I also added more explicit logging – so if you use multiple files you can see which is doing what. I also tidied up a few things]

It struck me the other day that this is equally true now for Oracle Policy Modeling – JavaScript extensions have a very well defined structure, and as I said above : you don’t write just any code – you write it the way you have to write it, in order to fit into the underlying architecture of our beloved interview.js.

Since I find myself often repeating the same JavaScript task over and over again – for example I need to create 2 custom Labels for 2 different projects or customers – I do a lot of cutting and pasting. But that often goes wrong as I forget I’ve renamed something or changed a variable somewhere.

So I decided to create a Code Generator – a sort of tool to create templates of code that I can use to create new files. And I decided to use Oracle Policy Automation for the job. Here is the sort of thing I am talking about:

Extension Code

By answering a few questions about the code you want to write, the Project generates a template for you to copy and paste into a new Text File and there you have your code to start writing something interesting. There is a Copy to Clipboard button at the bottom of the code.

In the end, I decided to add a few things to the examples to act as learning tools:

  1. The Input Control has Validate and Update options that help understand the way these Keys actually are supposed to work. Validate throws an error message to the user if the text entered does not match a specific validation rule.
  2. The Update Key shows how update is fired whenever anything on the Screen is updated. Useful for updating your Control in response to other activity on the Screen. As an example, the color of the Input changes each time Update is fired.

The Extension Code Generator also includes the custom Search as templates with the following options:

  1. Search lets you choose from a series of standard searches (Airlines, Railways Stations, etc) as well as allowing you to configure your own REST call and lets you add any Headers you need to make your call.

Here is a video that will hopefully shed some more light on what this Project does (or tries to do)!

This seemed like a fun thing to do in Oracle Policy Automation – if you would like a copy of the (18C) project then please leave a comment and I will tell you all about it’s foibles :).

Back to Basics 7 – Interview Styles

Back to Basics 7 – Interview Styles

This episode looks at something that crops us regularly in workshops or training sessions with Oracle Policy Automation. What can we do to make the interview more unique , more like my website, more modern? You name it, you can insert plenty of other things in there – most people will recognize the sort of discussions I’m sure.

All too often the next step appears to bring in web specialists. I’m not against that at all, in fact quite the opposite, but only at the point where it becomes necessary, because we cannot achieve what the customer is asking without it.

There does not need to be a lot of Cascading Style Sheet manipulation on every project – because there are a host of options that can be managed from inside the Oracle Policy Modeler application and that will result in a custom style being written for you, but without the need for actual CSS editing.

The Styles Dialog is perfectly good for a lot of basic groundwork. It’s great that so many different things can be adjusted so quickly without resorting to customization.

OPA 12 Interview Styles Dialog

Bare Metal

In fact one of the things I like most about the Interview is the ability to strip right back to a minimalist look and feel, which is great for focusing the minds present on the actual business rules and not the gadgets. My own favorite thing is to strip off the extra styling on the radio buttons, calendar and drop-downs. These controls are already lightly styled out of the box. Compare the following.

This is the standard look and feel and the bare metal side by side:

Notice the difference. The custom sprites have been removed from the radio buttons and the other controls have had similar treatment. This is controlled by one option in the appearances.properties file. This file can be found if you go to the Styles dialog and click the Custom Files… button on the bottom left corner, then accept the warning. To activate the option you will need to remove the “#” on the following line.

OPA 12 Interview Styles Appearances ExtractThe appearances.properties file contains so many useful options that I am glad you have found it!

Have fun until next time.


Back to Basics 5 – Using the Go To Button in Oracle Policy Modeler

Back to Basics 5 – Using the Go To Button in Oracle Policy Modeler

Alright so this one is a bit strange, but I wanted to point out a piece of screen Real-Estate that in my humble opinion does not get used enough. The Go To Button in Oracle Policy Modeler in the Microsoft Word Ribbon that you see when you are editing Word Documents using Oracle Policy Modeler. Let me demonstrate by showing you a screenshot, as this will hopefully make things clear.

the Go To Button in Oracle Policy Modeler

To be honest, the name on the button bugs me. It is not really a “Go To” button at all. For me, luddite that I am, “Go To” means go somewhere in my document. And while the Go To button in Oracle Policy Modeler does indicate location, it does not go anywhere. In fact you have to put your mouse on the relevant item to get it to work. It is more a “what’s here?” button if you ask me. And yes, it tells me of the different properties of the item I have put the cursor on. Like this:

the Go To Button in Oracle Policy Modeler -- Results Window

As you can see in the screenshot above, the mouse was clicked on the conclusion. Then the Go To button was clicked. The dialog that was displayed reveals the text and any locations it appears in the Project (for example if you have your logic in two separate Word files, they will both appear here). In addition there are shortcut buttons to edit the Attribute or jump into the Oracle Policy Modeler Debugger. But the best part, if you ask me, is the ability to pin the window and open one, or many, more at the same time. Sometimes when debugging a document written by someone else it can be useful to have these all displayed as reference points – or just because you are trying to keep track of several things at once. If you pin a window, you can go right ahead and “Go To” again on another Attribute or whatever takes your fancy.

the Go To Button in Oracle Policy Modeler Pinned Wiindows

This picture is too big to display immediately so you can click it to go to full size. These simple things can be the source of saved time and heartache – for finding misspellings and so on – and I’m happy to be talking about them here on the ODE OPA Blog. Oh, and I did a little dance just now as we passed the 100 post landmark. Woohoo!

Back to Basics 2 – Oracle Policy Modeler Articles

Back to Basics 2 – Oracle Policy Modeler Articles

Articles are a thorny point, since not all languages have the same concept. But the chances are that if you are working in a latin-based or greek-based language then you will have the concept of “the”, “le” or “la”, or “der”, “die”, “das” and so on. Writers who jump into Oracle Policy Modeler, especially those from other less natural-language focussed tools, tend to write rules that don’t have any articles, or that use the indefinite article. So what should we look out for in the area of Oracle Policy Modeler Articles?

Basic  Idea #2

Articles don’t matter.

Yes they do. Very much so. And perhaps the most insidious problems occur when there is no defined strategy at all, and everyone does what they feel like. For example, consider the following rule.

Oracle Policy Modeler Articles

Notice the lack of article. This rule will validate and work, despite it being a long way from natural language. However, what usually happens next is the entity model becomes more complex. So the designer adds an entity. Either “the customer” or “a customer”.


Notice how the original attributes, customer status and customer is always right, have remained attached to Global rather than the new Entity, since they didn’t contain the exact text “a customer”.


Now in the Debugger we can see the side effect in the language generation.  A customer looks weird. The customer would have been far more readable. And in the Interview debugging session, it looks pretty nasty too.


And of course at the same time, our Interview does not really work because the attribute is not applied to each customer, just to Global.



If we had adopted a common sense approach and created all of our attributes with the more natural “the customer…” we would have had less issues with matching attributes to Entities and better natural language generation, and last but not least it would have been far more normal to read in Word. Oracle Policy Modeler needs to have definite articles both for Entity names and attribute definitions. 

  • Customer is right – not natural language
  • A customer is right – which customer?
  • The customer is right – natural, specific to one customer



Chrome Debugging Policy Modeler Interviews

Chrome for Debugging Policy Modeler Interviews

When looking into an Oracle Policy Modeler Debug session, I often want to view the Interview in Google Chrome, even at an early stage. The embedded Web Browser of the Debugger being Internet Explorer-based (and for various reasons which I quite understand, not having all the Context Menu options that normal IE has), I want a quick way to get into Chrome. I need to see the CSS, the JavaScript, and all the rest. Basically give me a Browser Debug Console.

To do this requires Registry Editor work, but the result is worth the effort. Firstly, let me again make clear I am not responsible for anything you choose to do with this information – you should think before doing anything in the Registry, and make backups. The example I am giving is for Windows 10, since it seems to be the least obvious solution – certainly it took a fair bit of searching on the Internet to get this working.

Add the following Key to add the ability to call Chrome directly from a URL in Internet Explorer, so to speak. You are going to create a new protocol to add to the http:// https:// file:// res:// and so on that you can use already for links. My protocol is called Trickshot://. Doing this in Windows 10 is much harder than in previous versions since there are many more restrictions in the domain of programs, defaults and so on.

In addition, just so we understand each other, we are basically using a security issue that could, in theory, be hijacked for nefarious purposes.

Several registry keys are needed. One in the HKEY_LOCAL_MACHINE and one in HKEY_CLASSES_ROOT branch.

 @="\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\" -- %1"

"URL Protocol"=""



@="\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\" -- %1"

Obviously you would adjust the path to correspond to your system. Now if you go to Windows Run command and type “Trickshot:// google.fr” – with a space after the slashes and without the quotes, you should see Chrome open the relevant site. So now we could use this as a link in our Debugger. The link will work, but as a side effect, a window of the OPA Debugger will open, will fail to load the page (with an Unknown Protocol error) but then Chrome will start and you are looking at the Interview. You can start a new session, switch on the JavaScript Debugger of Chrome and so on.

Embed a label in your Interview (or put it somewhere, hard coded) that looks like this:

<a target="_blank" href="./" onclick="window.open('Trickshot:// ' + this.href, 'mynewwin');return false;">Go to Chrome</a>

This is just an example of course. Run the Interview with the Debug button as normal. Click your Go to Chrome link. When you click it, the Embedded Internet Explorer will fail to open it, but the registered application will take over and Chrome will load the page for you.

So the flow is something like this:

And of course, it is true, you could right click the normal Oracle Policy Modeler Debugger window, click Create Shortcut, minimize Oracle Policy Modeler, find the right Shortcut, run it in Chrome, ad eternam (so many useless icons on your Desktop!) and work like that. But I think this method is much faster and easier in the long run.

Have fun!


OPA 12 – Custom Styles and JavaScript visualization

OPA 12 – Custom Styles and JavaScript visualization

Whilst it is clear that over-customized Oracle Policy Modeler Interviews runs counter to the spirit and goals of having packaged software provide dematerialized interviews out of the box, it can and will be necessary to personalize the content of the interview to match for example the graphical standards of the customer’s own website or other applications.

In Oracle Policy Modeler, such customization is achieved in the Interview Tab, under the Styles Button.

OPA 12 - Styles Dialog

We can also add custom JavaScript or CSS files by clicking the Custom Files… button at the bottom left. Obviously we want to be able to review the HTML and CSS content of our interview. However, when we run the Debugger, the Embedded Web Browser that is used (essentially an embedded Internet Explorer) does not have the different debugging options we would expect – for example, there is no View Source option on the Context Menu in the OPA 12 Debugger. This can be quite irritating since you want to view the output HTML. You can improve your situation by doing the following (this involves changing the Windows Registry and you should not do that unless you are comfortable with it, and I will not be held responsible for anything you do). Add a new Registry Key under this existing key:

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer

You will need to add another couple of Keys:
OPA 12 - Change View Source

In the above example I have implemented Notepad ++ as the default viewer for Source from Internet Explorer (this works in the Embedded Web Browser too). Now I can right-click the debugger of OPA 12 and select View Source, and open the file in Notepad ++.

OPA 12 - View Source Option

And the file opens for viewing and consultation. This can be useful for learning about the different CSS classes as well as simply understanding how the HTML files actually work.

OPA 12 - HTML Source

Have a good day and see you soon


Conditions & Conclusions in Oracle Policy Automation Spreadsheets

Conditions and Conclusions in Oracle Policy Automation Excel Spreadsheets

Since this came up in the recent Oracle Policy Automation discussions I was having with a customer, it seemed a good idea to summarize it for people who are Getting Started with Oracle Policy Automation. There are two basic ways to use the column headings in an Excel file.

Using Column Headers with Condition or Conclusion Text

This is the usage that is taught first in the Oracle Policy Automation Essentials training. Using a small fragment of a fictitious speeding fine table, you can see the Condition Heading and Conclusion Heading formats are populated with Attribute Text.

Oracle Policy Automation - Using Table Headers with Attribute Text

Using Generic Column Headers

The second choice is to use generic headers, in fact these are the default headers inserted into the Excel file when you add it to your Project. In this example below you can clearly see the condition and conclusion texts in the relevant columns and the generic headers. This can be useful if you want, for example, to assert that different booleans are true as a result of a table row being true.

Oracle Policy Automation - Condition and Conclusion Generic Headers

Excel Limitations

There are some limitations which can occur when you are unfamiliar with Excel spreadsheets. Although these are not both directly related to generic column header usage I thought I would add them here for new starters to remind of the importance of using multiple columns where appropriate.

Oracle Policy Automation - Generic Conclusion Attempted Negative Error

As you can see in the example above, the use of a negative sentence in the generic conclusion is not allowed. We would have to reformat our table to use different, specific columns for our conclusion.

Oracle Policy Automation - Non Generic Conclusion Examples

Similarly, attempting to squeeze too much into a condition column will create another validation error:

Oracle Policy Automation - Generic Conditions Attempted Multiple Conditions

Hopefully this helps clarify what is possible, and what will need to be considered when getting started with Oracle Policy Automation Excel Spreadsheets. The official documentation can be found online here.

Have a nice day!

Natural Language in Oracle Policy Modeler- Missing Translations

Natural Language in Oracle Policy Modeler- Missing Translations

One of the things that irritates me, and I am sure (since I ask) other people is the lack of support for natural language versions of some pretty basic functions. For example, in English you can write (this is a screenshot in version 12 of Oracle Policy Modeler, in a Microsoft Word document) the following conclusion using a natural language “long form” function on the right hand side of the equals sign:

english natural language

This is a pretty standard function (the current date time) and I can think of gazillions of places where you would neeed to use it. In French, for example, the identical conclusion in a similar Project would need to look like this, where you can immediately see the section after the equals sign is no longer in natural language “long form”. You can find the function in the French function reference on the web here:


So why is this function not available to be written in “long form” in French (and in a number of other supported languages)? This is because of the lack of natural language French equivalent for the “current date time” function, in the dictionary file. Now I’m not suggesting this is a showstopper, but natural language is one of the biggest selling points of Oracle Policy Modeler in respect of working with non-technical team members. So it would be nice to see a more complete investment in providing translations for common functions.

For esoteric ones, I get it, it can be hard, But this is an easy one and a translation can readily be found. In a few days we will take a look at how to resolve this kind of issue.

OPA 10 – Missing “It is currently known”

OPA 10 – Missing “It is currently known” in a non-English language

This is an old one but it comes up now and again. Discussing with an Oracle Policy Modeler user (that was running Policy Automation in version 10.3) the other day, she remarked upon the lack of support for “it is currently known” or “it is currently unknown” in the rule language of choice of the user and how something that worked fine in another project (using a later version) did not compile at all in 10.3.  The solutions was to modify the relevant template file to provide the French mapping for the relevant English phrase.

In the installation folders of the relevant Oracle Policy Modeler, the templates.xml file can be located : choose the file relevant to the language needed (in this case for example the folder was “C:\….Policy Modeling\language\French\templates.xml”).

In this file we can see the different template of english phrases (for example, “currently known” or “currently unknown”) mappings to their non-English translations. If necessary, add the relevant Statement Operators and Variable Operators to the file, and restart Oracle Policy Modeler.

Check the existence of, or add t the following in the “statement operator” section of the file:

OPA 10 - Statement Operators

And the following  to the “variable operators” section of the same file:

OPA 10 -Variable Operators

These modifications allowed the documents in French to compile and be used. There are quite a few similar posts hanging around on the Internet, for example here is one involving Swedish.

Of course one should pay close attention to the XML file structure, and where possible use an existing language XML to help model the correct elements in your chosen language to create a valid XML structure for your templates.xml. In this case the easiest approach was to search for “currently known” in an existing file and work from there.

OPA 12 – Reference to Source Materials

OPA 12 – Reference to Source Materials

One of our readers, Anthony B,  was kind enough to get in touch with the On Demand Education OPA Blog regarding the previous post in the OPA 12 Series, specifically this one regarding the lack of support for the Tab Key and the old technique of create a reference to source documents. At the time of writing that article, I had not yet installed the November release. The August release had a bug which stopped the feature working, namely the references were simply deleted upon clicking the Validate (aka Compile in Version 10) button.

Having now done the migration to the November 2015  release, I can indeed say that the concept of references to source material has now been reinstated. The feature is simple to implement. You add square-bracketed references to your rules, in the manner of the example below.

OPA References

Upon Validation, the text should be shown in grey. Further examination shows that the text is not formatted differently to the rest of the line. (using Draft View to see the Styles).OPA References Styles View

The Explanation (aka Decision Report) shows the correct output as well for the discerning user, complete with the correct reference.

OPA 12 Explanation with Reference

Thanks to Oracle for correcting this bug in November’s release, and thanks to our reader for pointing this out. In the coming weeks we will be looking at some of the other new things that have crept into November 2015’s release that will improve your experience. I’ll be teaching Oracle Policy Automation over the holiday period but if you are taking some downtime, until next time, Happy Holidays!



Logo by Southpaw Projects LLC