Following on from the announcement of the release of Oracle Intelligent Advisor 21B and our article about the new capability to reference Decision Services in Oracle Policy Modeling, comes another article to discuss further new features. Both of these new features add significantly to the JavaScript API as it moves from being a thin layer of physical rendering to a more rich environment supporting elements of the presentation model as well.
Implement Custom Events and trigger code in the Intelligent Advisor 21B JavaScript API
A cool nugget giving the ability to expose specific events is the new custom events feature referenced in the relevant section of the online help for Oracle Intelligent Advisor 21B. An interview object can now send a custom event, and the JavaScript embedding client can receive this event and handle it with code as required in the external HTML application.
For example, you can call the following in the interview object method:
interview.sendCustomEvent(event)
This sends the custom event to the embedding code in a onCustomEvent handler and returns the value that is returned by that handler. There is no constraint on what is passed in the event. If the interview is not running embedded, or the embedding page does not supply an onCustomEvent handler, then sendCustomEvent will do nothing.
Which means in your embed code in your external application you need to add a new startConfig object property when you are setting up your interview start or resume code, in the same manner as the existing options like onLoad or onNavigate. This example with seedData starts two interviews, one of which has a custom Event handler and the other an onNavigate handler (note – not all code is shown for brevity):
var webDeterminationsUrl = "http://xxx:yyy/20b/web-determinations";
function doCustomEvent(event){
// something cool }
var startConfig = [
{
operation: "start",
el: document.getElementById("routemapper_1"),
deploymentName: "dep_name",
onCustomEvent(event): doCustomEvent,
seedData : {"origin" : "Madeleine"}
},
{
operation: "start",
el: document.getElementById("IBAN_1"),
deploymentName: "IBAN_Check",
onNavigate: doExit
}
];
OraclePolicyAutomationInterview.BatchStartOrResume(webDeterminationsUrl, startConfig);
So now your external code can handle the arrival of the custom event and return anything needed. Or just perform tests like this where a WordPress application can receive the custom Event from Oracle Intelligent Advisor:

These enhancements serve to remind us of the strong growth of the platform that is Oracle Intelligent Advisor 21B, as well as the focus of Oracle in creating an even more complete engine for customers to transform their business rule experience. Although these enhancements are targeting a technical audience, they come at the same time as big investment in web-based Decision Services continues to make Intelligent Advisor more and more accessible to the business users. Oracle Intelligent Advisor 21B continues in that vein.
Great things are happening in Oracle Intelligent Advisor. Keep up with the changes and learn more by registering form one or more of the many Oracle virtual events coming up. You might also be interested in these 21B topics :