It all comes down to the many environments that are bing used. Obvioiusly you have the absolute minimum: a Development environment (we'll call it DEV) and a Production environment (which we'll call PROD).
You can have a number of environments in between those, which have different names everywhere I go. For example you may have a specific "Project Environment" or a "User Acceptance Test Environment". You may also have an "Integration Test Environment".
All these environments have obviously a different URL-construction. It all depends on how your IT department is structuring its architecture. There are no strict rules ... it can be WHATEVER!
But sometimes you just need an exact reference to say where you can find things. Perhaps you're forced to use a CSS-strategy where IT wants you to store all CSS things in one place.
Or you have a specific logout-link that needs to point to the login URL of you application (in fact, being EBS or not makes no difference here). But for suer this URL is different in your DEV compared to the one in PROD!
So I came up some years ago with a solution for EBS integrated APEX applications. Using the available profile options.
This solution was built on an EBS 12.0.3 environment, but it still works also on later versions.
The APEX version it was first developped in was APEX 4.0, but it is still working on APEX 4.2.6 and it's using absolutely only standard APEX stuff. No rocket science whatsoever. So no reason to think why this would stop working once APEX 5.0 gets introduced.
Here are the ingredients and the recipe
- Application item AI_BASE_URL to store the base of the URL;
- Application process Init items after login to fill the Application Item;
- A list entry with path reference;
- Navigation Bar entry to your Home page;
- Navigation Bar entry to your Logout page.
For now I make the assumption that you have correctly integrated your EBS environment with your APEX environment. If you have done this, you will be able to use the secured views of EBS in your APEX app and you will be able to use the EBS API's as well. This is a must for this solution to work properly!
Step by step approach
In the Application Builder, navigate to the shared components to create the Application Item and the Application Process.
1. Application ItemCreate a new Application Item. It is ALWAYS a good idea to use the prefex "AI" for an application item. It's just easy to recognize it every where in your code.
AI_BASE_URL is a good name.
Tip: use functional meaningful names for your items. Certainly application items. But also keep in mind that you will be typing them several times. Even if you have 30 characters to spare ... you may want to choose short names!
Creating an Application Item is very simple. Just remember to set your scope, in this case Application. And think about security: Restrict it to be set from the browser.
It would have been a good idea to enter in the comment field e.g. the place where you are using/setting the item. Although of course the help functionality in APEX is pretty good as well to find that out!
2. Application ProcessWe need an application process that fires just after login. Remember, you're working in an EBS integrated environment. So the login page is omitted, but the login DOES happen.
Create a new process:
We're using an EBS API to capture a standard profile option that keeps the ... yes exactly: base URL information.
In the example I set the PROD URL to be used in case the API would return no value. This is done because profile options may be updated by the system administrator. Normally that shouldn't be the case. But better save than sorry! This obviously means you have to test your stuff. Because when you use it in a logout-url, after logging out from a DEV environment for which the BASE-URL is not found, it will point to the PROD URL. This can be very confusing!!
Tip: only fill the PROD-URL that you use in the NVL construciton just before you move your app to production. Or as a minimum after you have decently tested everything on different environments. I usually set it to "google.be" until the very last moment!
In fact ... you're now done. You did everything to fill the AI. This is really all there is to it. Now all you have to do is use it in a proper way.
Here are some examples ...
3. References to images (and other stuff)In a given situation it was opted to upload a whole set of images and a general CSS file to a specific location on the server. This was a sub-structure of the "AI_BASE_URL".
In (e.g.) the menu list entries some of these images where used as reference icons. I used the AI_BASE_URL to reference these images:
4. Navigation Bar entry using URL targetIn EBS the Home page is a specific page from which you start every action. It identifies who you are and what role (or roles) you have. And for each role (authorisation) which actions you are allowed to do.
In most cases your created APEX extension will be one of the actions (called form functions in EBS).
So you want in your integrated APEX app a link to this home page. This is done because it would be impossible to navigate back to your EBS environment if you hadn't foreseen this. So the - bad - alternative is that you logout or even kill your browser session. And then obviously a new login in required to continue with your work.
In this example that "Home" URL is constructed, making use of the AI_BASE_URL:
And exactly the same was done for the Logout URL:
Happy to share ...