🔒 How to Control Visibility in Oracle APEX Using Developer Mode

🚩Introduction 

  • In real-world Oracle APEX applications, there are situations where certain items, regions, or buttons should behave differently depending on how the application is accessed. For example, when developers run the app from App Builder (developer mode), they may need to see additional debug information or admin controls, while end users accessing the app through a normal URL should not see these elements. Managing this behavior using static conditions can become difficult and less flexible.

  • To handle this, APEX provides a simple way to detect whether the application is running in developer mode using APEX_APPLICATION.G_EDIT_COOKIE_SESSION_ID. By checking if this value is not null, we can dynamically show or hide items, regions, and buttons at runtime. This approach helps create cleaner user interfaces for end users while still giving developers the controls they need during development and testing.

📑 Why This Approach Is Needed

In Oracle APEX applications, not all components should be visible to every user. Some elements are useful only during development, while others are meant for end users. Without a proper way to control this, the interface can become cluttered and confusing.

This approach becomes useful when:

  • Developer-only buttons or regions should be hidden from end users
  • Debug or testing information needs to be visible only in App Builder mode

  • Admin controls should not appear in production access

  • UI behavior needs to change between development and runtime

  • A cleaner and safer user experience is required for end users

Using this method ensures better control, improved security, and a more flexible way to manage UI components based on the application context.

👉 Use Case: Show/Hide Components Based on Developer Mode

In Oracle APEX applications, sometimes we need to show certain buttons, regions, or items only when the app is run from App Builder (developer mode), and hide them when accessed through a normal URL. This helps keep the UI clean for end users while giving developers access to additional controls during development.

Step 1: 

In the page designer, create a region of type static content and create one button which should be visible only in the developer mode. Change the button slot postion to Copy.

 Step 2: 

Select the button and in the properties tab, navigate to the Server-side Condition section, select the type as Expression and enter the following expression given below.
APEX_APPLICATION.G_EDIT_COOKIE_SESSION_ID is not null 

 
When you run an application from the App Builder, the expression will return session ID (not null). But when the application is opened by end users through a normal link, the expression will return null value. Using this approach, we can hide / show the components when you run the application in the developer mode.

 Step 3: 

Now save and run the page from the app builder (Developer Mode), you will see the button rendered in the page.


Now copy the url and run in the another browser (standalone), the button will not be rendered in that page.

🔥 Conclusion

Thus, in Oracle APEX, we can control the visibility of items, regions, and buttons using APEX_APPLICATION.G_EDIT_COOKIE_SESSION_ID without any plugins. This helps show developer-specific elements only in App Builder and keep the UI clean for end users, improving both usability and maintainability.

Comments

Popular posts from this blog

🔍 Extending Smart Search Filter for Multiple Regions

💡 Designing Dynamic QuickPicks in Oracle APEX

📌Track Active Tab switch in Region Display Selector without any plugins