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 =;
				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.

Richard Napier

Author: Richard Napier

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 his Consulting and mentoring company, On Demand Consulting & Education Ltd and has run ODCE since 2010. Owner of the OPA Hub, he also is Co-Founder of the Siebel Hub.

2 thoughts on “Custom Options : Dynamic List of Values

  1. hello Richard
    first thing, thanks for the effort you put into this site it’s helped me a few times. I have been using opa/service cloud/engagement cloud for a number of years. I am an independent consultant based in Perth in Western Australia.
    I have been trying the dynamic list of values extension from the web site and am getting a javascript error I can’t track down.

    I have copied the example with no changes, is there an issue you know about or is it me?


    1. Hey Jeff. Thanks for reaching out and for the conversation we have just been having. The potential solution is related to the “entityname” custom property in this example – if it is blank or missing there is no code to check – and for speed I didn’t make it dynamic. To make it clear I have added a working project Zip to the Product in the Shop – using 19B but tested on 19C and 19D as well – so it’s easier to crosscheck.

Leave a Reply

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

Logo by Southpaw Projects LLC