getValueText() and opm.extension.config.json – A new File

For those who read the minutiae of online documentation, it will not have escaped notice that a new file has crept into the distribution for projects in version 21B. This file is only used in one specific scenario and has to be added manually. So what is opm.extension.config.json and what is getValueText()?

It is a file used in conjunction with one specific function (getValueText()) which can be used in Interview Extensions. Let’s work through an example. Suppose that you have an input extension that displays the values of an attribute in a dropdown:

getValueText() Example

/*  Generated by the intelligent-advisor.com Website Code Generator 08/06/2021 16:06
Boilerplate Code of Custom Input Extension for Intelligent Advisor fka Policy Automation
I will remember this is for demonstration purposes only.
 */
OraclePolicyAutomation.AddExtension({
	customInput: function (control, interview) {
		if (control.getProperty("name") == "ValueText") {
			return {
				mount: function (el) {
					var div = document.createElement("select");
					var array = ["", "Red", "Yellow", "Amber", "Green", "Gold"]
					for (var i = 0; i < array.length; i++) {
						var option = document.createElement("option");
						option.value = array[i];
						option.text = array[i];
						div.appendChild(option);
					}
					div.id = "ValueTextDemo";
					div.value = interview.getValue("myattribute");
					el.appendChild(div);
					$("#ValueTextDemo").change(function () {
						var thecontrol = document.getElementById("ValueTextDemo");
						interview.setInputValue("myattribute", thecontrol.options[thecontrol.selectedIndex].value);
						var label = document.createElement("div");
						label.innerHTML = "getValue() returns " + control.getValue() + " and getValueText() returns " + control.getValueText("myattribute");
						el.appendChild(label);
						event.stopImmediatePropagation();
					});
					
				},
				unmount: function (el) {
				}
			}
		}
	}
})

In the example above, each time the value is changed to one of the listed options (Red, Green and so on) then a label is written to the page to show you two things

  • The result of a getValue() – this will return “Red”, “Green” or whatever. This has been around for a long time.
  • The result of a getValueText() – this is new in 21B, and requires you to have “switched on” the option using the JSON file just mentioned.

Running the code without the JSON file in your resources folder (where the JavaScript and other resources will go) will result in the following error message:

getValueText() not enabled

If you add the file referenced above, and complete it in the following fashion:

{
    "getValueText": true
}

The code will run successfully and getValueText() will return a value:

getValueText() Enabled via JSON file

getValueText returns the full, interview-style text of the attribute value. So getValue() and getValueText() now provide us functionality like we already had in Forms using BI Publisher or a PDF Editor, whereby you had two form fields, one for the value and one for the attribute text.

This sort of “long text” is useful when constructing conversational-style interviews since it means the responses can feel more “human”. The way it was implemented (who wants to be fiddling with a JSON file to switch this on or off) is a little different but the functionality is interesting. I hope that getValueText() proves useful to you!

The official documentation has a short description of the functionality.

PS – interested in the integration of Forms into Oracle Digital Assistant?

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 intelligent-advisor.com, 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