Apex Quick Tip for Devs: Url including Workspace

scenario

If you are like me and are using many workspaces, it is easy to get lost which workspace works on which host and I also tend to mix up/forget workspace names. The easy solution is to have bookmarks/favorites that store access to a specific the workspace.

However this doesn’t work out of the box.

If the login page on the same host is called a second time, then the workspace name stays. This is implemented via a cookie (ORA_WWV_REMEMBER_UN in Apex 18+). The cookie stores the most recent workspace name and user name for a certain time. If you have several different workspaces under the same url, the cookie will only remember the last one. If you try to bookmark this url, then it will always show the most recent workspace not active one when you bookmarked it. And not even the last workspace might be remembered once you come back from vacation, because the cookie expired meanwhile.

APEX is written in APEX. We can use our knowledge about APEX urls, to set the correct workspace via url parameters.

solution

The login page for the internal apex application 4550 is page 1.
We can inspect the login page to find out about the correct item name.
inspect_workspace_item

The field with the workspace name is F4550_P1_COMPANY.
Simply supply the name of item and the value (=workspace name) like in any other apex application to the url.

Here is an example for apex.oracle.com. One of my workspace names is “SYNTESTWS”. And this will be the url, that I bookmark.

https://apex.oracle.com/pls/apex/f?p=4550:1:::::F4550_P1_COMPANY:SYNTESTWS

It also works with the username. Although I find that slightly less useful.

https://apex.oracle.com/pls/apex/f?p=4550:1:::::F4550_P1_COMPANY,F4550_P1_USERNAME:SYNTEGRIS,MYSELF

If you copy a real url, don’t forget to remove the session identifier information from the url. It does not make sense to bookmark that.

other related information

In Apex 18 the cookie info was improves (more in compliance with GDPR I think).
apex_workspace_url

The parts of the url (especially the “p” parameter of the “f” function) are documented:
Apex url syntax
url_set_items
Also my Apex Quick Reference which sports Apex url syntax as a quick lookup tool and the next Syntegris 2019 calendar will feature Apex Urls. So try to get one of those during the next conferences (cu at DOAG 2018).

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

This site uses Akismet to reduce spam. Learn how your comment data is processed.