In APEX we have many Substitution Strings. One of these is :APP_PAGE_ID. Be careful with this String in an OnDemandProcess. I have called an OnDemandProcess by using JavaScript/AJAX and the result was, that :APP_PAGE_ID was always 0.
To solve this problem i have created an Application Item (AI_APP_PAGE_ID). This item will be filled every time a page is rendered in APEX.
*Update*
Due some good tips the problem can be solved by calling the OnDemandProcess with the correct full syntax from JavaScript.
var ajaxCall = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=IS_HANDLE_VALID', $v('pFlowStepId'));
With this call especially the last parameter $v('pFlowStepId') the pageId will be the actual ApexPageId where the Javascript is used.
Thanks to Peter and Roel for your tips.
Quick Question: how exactly did you call the Application Process? Did you pass the Page-Id there?
ReplyDeletei called the process by javascript like
ReplyDeletevar ajaxCall = new htmldb_Get(null,html_GetElement('pFlowId').value,
'APPLICATION_PROCESS=IS_HANDLE_VALID',0);
Oliver, you could try to specify the actual Page-Id instead of the 0 in your example.
ReplyDeleteSee this Definition: function htmldb_Get(obj,flow,req,page,instance,proc,queryString) {
When you call it that way, you specify it runs on Page 0 (the last parameter).
ReplyDeleteWhat happens when you do:
var ajaxCall = new htmldb_Get(null,$v('pFlowId'),'APPLICATION_PROCESS=IS_HANDLE_VALID', $v('pFlowStepId'));
ok, do you have a link to the full definition of htmldb_get?
ReplyDeleteBig thanks for your Tips.
ReplyDelete@Roel
Yes Roel, with your example the Variable APP_PAGE_ID is now set to the correct page ID even when the Process is called from JavaScript.
To get the full definition of htmldb_Get (as posted above) you simply have to look into the apex-javascript file (part of your APEX Installation, you can find it in images/javascript).
ReplyDeleteWhy is this javascript function not part of the official API?
ReplyDeleteWhat makes you think it is not official?
ReplyDeleteIt is just not mentioned in the Documentation ;-)
In my personal documentation, I've found a url (http://apex.oracle.com/pls/otn/f?p=11933:63) pointing to some old APEX application, if I'm not mistaken from Carl Backstrom, explaining the usage and parameters of htmldb_Get.
ReplyDeleteMaybe this can help you out.
Thanks for your tip. That documentation is what i searched for.
DeleteThank you very much for this article. It was very helpful since I had the same matter. Thanks again.
ReplyDelete