Oracle Forms 11g and Apex using external events

I remembered an old post of Roel Hartman where he integrated a form into apex.
He used a part of OraFormsFaces by Wilfred van der Deijl: the CommunicatorBean.
Using this CommunicatorBean forms could react on “external messages”.
Now with Forms 11g reacting on external events, this CommunicatorBean isn’t necessary any more(sorry Wilfred).

This is how I did it using external events…
First things first: set up the advanced queueing mechanism.
Check this tutorial which includes setting up advanced queueing.
I created a little form based on emp(nothing fancy)…

The new feature in forms:

With the following properties:

What should forms execute when this event happens?
This has to be specified in the When-event-raised trigger.

In this case we retrieve the payload and extract the empno from it.
The empno is used to set the default where clause on the block.
When there’s an empno on the queue, forms will query that employee.
That’s all for the forms part…
Now I created a little Apex page with two regions:

The Employee details will be our form.
So I put our form in the HTML using an iframe:

Using a “select list” it’s possible to select an employee.

This is the result:

Now the purpose of the select list is to choose an employee and show the detail information in our form.
In order to do this, the select list calls a javascript function.

This javascript function is created in the HTML header

The code behind this:

<script language=”JavaScript” type=”text/javascript”>
function getEmployee (){
var emp = $x(‘P2_EMPNO’);
// send request
var ajaxRequest = new

// get response
ajaxResult = ajaxRequest.get();
ajaxRequest = null;

This javascript function calls an application process and uses the empno as parameter.
The application process put the empno on the queue.

When changing the select list, the form is queried

This is a solution to integrate forms into another application whether it’s Apex, ADF or another web applicaton.
When it can put something on the queue, forms can react on it.
And yes, I could do it using the javascript feature in Forms 11g. I know…
And for Apex it’s probably a better solution, as we can skip the AQ part and make calls to and from forms in Javascript.


2 thoughts on “Oracle Forms 11g and Apex using external events

  1. I just noticed this older post and wanted to comment as being the creator of OraFormsFaces. The CommunicatorBean is only a very small component of the entire toolkit and is only required to create a JavaScript API in Forms 10g. From version 11 onwards OraFormsFaces will just leverage the native JavaScript API from Forms.

    Having a JavaScript API is critical to the functioning of OraFormsFaces but it is not the main feature. Most of the complexity is to have a single Forms applet instance to be re-used on several pages in your application. You don’t want the user to endure the applet startup time on each page. It is technically possible to re-use the same applet instance but it does require a number of extensions and workarounds to be able to pass parameters between the web application and Forms and to detect the applet instance is being reused on a different page. For this last feature we added two new events: WHEN-APPLET-SUSPENDED and WHEN-APPLET-ACTIVATED which are not supported by Forms natively.

    There’s also functionality to prevent the user from having to log in to both the web application and then again to the Forms applet.

    Feel free to download a trial copy by starting JDeveloper and using the Check For Updates feature (be sure to enable the OpenSource and Partners update center in the wizard). The download includes a demo application showing the features of OraFormsFaces. You can also have a look at the Developer’s Guide to get a feel for the possibilities:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

About Gert Poel