Tag: Value Lists

Custom Options : Dynamic List of Values

Custom Options : Dynamic List of Values

One of the things that I always found strange about early Oracle Policy Modeling 12 versions was the inability to use Excel (or Word) as the basis for a List of Values. You either dropped them into the Screen Control as Values, or you built a Value List in the Project tab.

Neither of those seemed to exactly be the “business friendly” sort of thing that was everywhere else in Oracle Policy Modeling. Then along came the “Use Values From Rules” button that showed up a few versions ago:

Custom Options - Use Values from rules

And I thought, Great! Now I can have dynamic values read from an Excel or Word document. But actually, that’s not what it means. It imports the values from the source document, but the link is not dynamic. Change the values, and you would have to click the button again. To me, that just doesn’t really give me what I want.

Now, of course, I’m not about to suggest that every list of values needs to be dynamically loaded at run-time, nor do I want to have to do that. But consider a very simple idea. I have an Entity, with a bunch of instances. And I want to use those instances to be the dynamic content of my list of values. So if the user enters instances on Screen 1, I want to show a drop-down on Screen 12 with the instances as the source of my list of values. I don’t want to create a relationship control : this is not about relationships. This is just about using dynamic values for my list. It seems so obvious to me. But given I may not be thinking like everyone else is, that’s fine too.

One final point : with my luck, the Oracle Policy Automation team will deliver this functionality in the next version!

So here is what we want to do:

  1. Build an Excel sheet with some data
  2. Use that to display a dynamic list of values

This will be a Custom Options extension, since that allows us to load data from an Object in JavaScript. Let’s take the example of a list of train stations (from a previous project we’ve used on the OPA Hub Website).

Custom Options Data Source

Now we need to build a Custom Options JavaScript extension, using the standard template.

	customOptions: function (control, interview) {
		if (control.getProperty("name") == "xOptionsParent") {
			console.log("Custom Options Extension found " + control.getProperty("name"));
				var entityId = control.getProperty("entityname");
				var entities = interview._session.config.data;
				var entityinstance;
				var entity;
				var myStations = []
				for (i = 0; i < entities.length; i++) {
					entity = entities[i];
					if (entity.entityId === entityId) {
				var Stations = entity.instances;
				for (i = 0; i < Stations.length; i++) {
					myObject = new Object();
					for (j = 0; j < Stations[i].attributes.length; j++) {
						entityinstance = Stations[i].attributes[j];
						if (entityinstance.attributeId === "station") {
							textofentry = entityinstance.value
					myObject.text = textofentry.toString();
					myObject.value = textofentry.toString();
				console.log("List of stations now ready" + JSON.stringify(myStations));
				return {
					options: myStations,
					controlType: "Dropdown"

Let’s look through the code:
Lines 6-10 : Using a Custom Property, cycle through the entities on the Screen and find our Source entity.
Lines 16-30 : iterate through all the instances of that entity, pulling out one attribute. Push that attribute into an Object, twice : once for the value, once for the display value. Of course this is where you could add a Filter and do something clever like only show values that meet some criteria or other.
Lines 35-38 : return the Object, and request a Drop-down (you can also specify other choices like “Radiobutton” or “text-button-group”). The value is case sensitive.

As always, this code is just for educational and entertainment purposes, and I definitely do not imply any warranty or fitness for purpose. Quite the opposite.

To implement it, place the following on a Screen

  1. Your attribute that displays the data. I’m using a Global attribute.
  2. Remember that all the things you want to reference in JavaScript need an attribute name, or an entity name.
  3. An entity container for your Source entity. I chose to hide mine using a Boolean which I hard coded in a Word document. Remember that currently, you need the information source to be present on the Screen to be able to access it in JavaScript.
  4. Add two Custom  Properties to the Control : one for the name and one for the entityname.

It might look like this :

  1. At a minimum add an Entity Container for your Source.
  2. Add the attribute that will be the Custom Options list.
  3. Configure the attribute to have the Custom Properties

At run-time, your drop-down will appear:

Now don’t go loading 500 values into your drop-down, since this is all handled at run-time. But of course, moderation in all things will mean you get what you want.

I’ve added this to the OPA Hub Shop – in the next part of this article, we will take Custom Options to the next level and find a way to make a hierarchy of dynamic values, without having to mess with XML formats, or import anything, or hook up a Connection.

List of Values, Display Values and Translations in Oracle Policy Automation

List of Values, Display Values and Translations  in Oracle Policy Automation

A common List of Values question that comes up is the following:

“How are list of values handled in Oracle Policy Automation, when I have more than one language? What gets put into the database?”

Of course, by “database” I mean whatever platform you are using to save the response from Oracle Policy Automation  : Oracle Sales Cloud, Oracle Service Cloud, Oracle Siebel CRM, Salesforce or any other.  For the record, the exact behaviour of your Connector will depend on how it has been programmed,but if it is doing what it should be doing, then the following information will apply.

The question that comes up is actually, to be fair, usually more detailed : people want to know the behaviour of the list of values both when it is created as a Screen element (single-use) or as a Value List (multi-use) and when there is more than one language involved. Well, fear not because the video below will answer all of those questions I hope, in a friendly and easy to follow way.

Imagine you have a Project in Oracle Policy Automation that includes an attribute of type Text, with a drop-down list to display values for the user.

  • What if there are multiple languages?
  • What if you use Screen-based Values?
  • What if you add Display Values as well as Values?
  • What if you migrate to Project Value Lists?
  • What editing might you have to do in your Translation file(s)?
  • What gets into the database?

List of ValuesAll these points will be covered in the video. Hopefully there will be no surprises in the video itself,  but it will be useful to see it in action and get confirmation of what you think might happen. And as mentioned previously, a big thanks to our OPA Hub Website Sponsors Mantis Solutions, makers of the OPA DB Connector, whose assistance made this video way easier to create and much faster to implement. If you are interested in Mantis OPA DB Connector, please reach out here.


Until the next post, I hope you are (at least those of you in the Northern Hemisphere) all having a pleasant Summer.

Whats New in Oracle Policy Automation 18A #1

Whats New in Oracle Policy Automation 18A #1

Whats New in Oracle Policy Automation 18A #1

And so the latest and greatest version of Oracle Policy Automation has just hit the shelves, I’m of course talking about version 18A which became available for download from the Oracle Policy Automation Downloads page on the Oracle Technology Network pages. The list of what’s new is quite short this time, although we can imagine that lots of things have been going on behind the scenes given some of the early access info that has been filtering out on the official Oracle Policy Automation Blog these last few weeks. So, on with Whats New in Oracle Policy Automation 18A #1!

Whats New in Oracle Policy Automation 18A #1

Automatically Retrieve List Values from Rules

The biggest addition to the Oracle Policy Modelling experience in this new version is the concept of dynamically (or almost) retrieval of lists of values from rules. I’ll give you an example that you might be familiar with. You have written rules that deal with an attribute, of type Text, and you have referenced it several times with different values, perhaps as a condition to some conclusion. And now you want to add it to an interview. At some point you will find yourself copying and pasting the values in your Word document into a Value List or a plain old List of values in the Interview Screen.

Well, not any more. The video in the next paragraph shows off the new functionality, whereby the modeler can retrieve the values at the click of a button and add them to a screen, or of course use the existing functionality to turn them into a Value List. The video goes on to demonstrate what happens when you go back and edit the rules in the Word document, and what happens when you change the Control type – for example from Drop Down to Fixed List and so on.

The example uses a fictitious restaurant deciding the correct level of spices to be added to their sauce, depending on the customer selection.


That concludes our post Whats New in Oracle Policy Automation 18A #1, in the next post we will look at some improvements to the REST API (which we looked at in earlier posts) to enhance user lifecycle management.

Logo by Southpaw Projects LLC