Skip to main content

Global page in APEX (page zero)

T

There are plenty of things you can do on global page. Not everything is a great idea. Typical usage would be:

  • Regions used on multiple pages
  • Page items used through multiple pages
  • JavaScript and CSS styles
  • Dynamic actions
  • Footer with some extra info


Regions

Typically it is some sort of navigations or filtering and that is perfectly fine. You should be aware that you can also create same region with source as "Function Body returning SQL Query" or by using "Dynamic Content" region (and ofc. having content in package, not on page). For complex components you could also create your own plugin. This is useful to know specially if you want the same content on different places on page.


JavaScript and CSS styles

It might be ok to have scripts and styles on global page, but unless you need them just on specific pages (or you want to apply server side conditions to them), I would rather store them in application files. Or even better in workspace files if they are used by multiple apps. For example I create static content region for dynamic colors on global page. I let user to pick own colors for various things and then I will create CSS classes on global page so these colors are applied everywhere.

I would suggest to create these as layout position "Before Footer" so they are not cluttering your Rendering tree on regular pages.


Page items

The good use case for P0 items would be an application item which you need to refer in JavaScript or if you need to control caching, server side conditions. If you dont need that, then create it as application item instead. If you want to use a shared item in between multiple applications, you have to create it as application item with "Global" scope. Some people use Substitution strings, you should consider application items instead.


Dynamic actions

This is a great way how to make your apps messy.
But I like to create here these two actions:

CLOSE_DIALOG action is attached to each close button on each modal dialog page (via the CLOSE_DIALOG static_id). Cool thing is that it checks for changes on page before closing the dialog (via Confirm action, "apex.page.isChanged()" JS expression).

DIALOG_CLOSED action detects closed dialogs so I can pass messages from dialogs to parent page (should be fixed in APEX 23.2) and also fire whatever action I need (based on page number).

console.log('MODAL_CLOSED', this.data.dialogPageId);	// which page closed?
if (this.data && this.data.successMessage && this.data.successMessage.text) {
    show_success(this.data.successMessage.text);
}


Footer

You can add things here too, depending on the content you could also change the whole page template.

Copyright info, business links, support chat, feedback surveys, additional info for developers (environment, items, whatever you need) visible only for developers, sometimes only if page is in debug mode.


So, what treasures are you hiding on page zero?


Comments