Accessing the last request value from a page submission

When you submit the page, you will typically have page processes that run. For me, I use these request values to determine which processes are run. This is rather straight forward for on submit processes as you can just specify the condition request = Expression 1

Or, if you have multiple requests that link to this process, Request is Contained within Expression 1, and Expression 1 would be a comma delimited set of values.

Request simply refers to the bind variable :REQUEST (or apex_application.g_request).

If we try and do the same on a page rendering process, we no longer have access to this value - which makes sense.

If you update the branch, to set the request portion of the URL, we will then be able to access the bind variable :REQUEST in all page rendering processing points.

This has the obvious downside that if the user wants to reload the page,  clicks in the address bar and hits enter (or clicks refresh), the processes on that condition will run again.

It also doesn't seem to give us access to the request in javascript which we may want to use in a dynamic action of some sort.

The accepted solution seems to be just to create your own hidden item to store the value in and use that. One important tip however is to clear the value after you've used it, so that the processes don't continually get called when refreshing the page.

So, have an on submit process that runs PL/SQL with something similar to:


Then in your on load dynamic action, after all the logic you implement, issue the following to clear the session state:

apex.server.process('', { pageItems: ['P1_HIDDEN_ITEM']}, {dataType: 'text'});

If you wanted a re-usable solution, you could do this.

Create a hidden region on global page, and add a hidden item (P0_SUBMITTED_REQUEST)

Create two application processes:

On Submit: After Page Submission - Before Computations and Validations, a with process text:


Specify sequence as 1 so it's the first process run when submitting the page.

And then another:

On Load: After Footer (page template footer)


Specify a high enough sequence that it will run after all other sequences. e.g. 1000 should be high enough.

Then in your page page rendering processes (well, any processes really), you can specify a condition that Value of Item / Column in Expression 1 = Expression 2:

Then in JavaScript (assuming you call it before the value is cleared) you can access the value with $v('P0_SUBMITTED_REQUEST'). This works with an on load dynamic action as the code is called before the page has completed i.e. calling the process which clears the value.

You can refrain from clearing it, however I prefer clearing it as if the user reloads the page, the value will still be lingering and all processes will be re-called.

For another useful solution when dealing with checksums, check out Recx's blog:

Popular posts from this blog

Report row buttons firing a dynamic action

Installing Oracle Instant Client on Ubuntu