Understanding Application Processes

Application processes are blocks of PL/SQL logic that are set to run at specific points using processes from multiple pages of an application. By default, application processes execute at the same point for every page in the application. However, you can apply conditions for specific pages to control when the process executes.

Topics:

About On Demand Application Processes

An On Demand process is special type of application process which as has a Process Point of On Demand and executes when called from a page-level On Demand process or from an AJAX call from the browser. On Demand processes are useful when you have PL/SQL logic that you would like to run from different execution points across multiple pages.

Running an On Demand Process from a Page Request

You can have a page request run an On Demand process by using the following syntax:

f?p=application_id:page_id:session:APPLICATION_PROCESS=process_id

Where:

  • application_id is the application ID or alphanumeric alias

  • page_id is the page number or alphanumeric alias

  • session is the session ID

  • APPLICATION_PROCESS=process_id is the keyword APPLICATION_PROCESS= followed by either the process ID or an alphanumeric name of an application-level process having a Process Point of On Demand

When you use this syntax, the Application Express engine recognizes the request and processes it using the following rules:

  • The page number in the URL can be the current page number or alias. A page number or alias is required in the request only as a syntactic placeholder because no specific page is accessed for this type of request.

  • The process authorization scheme, the application's authorization scheme, and the process conditions are supported.

  • Session state (that is, item names and values) may be set in the URL, but clear cache options are ignored.

  • Any failures of authentication, authorization, or process conditions do not result in visible error messages or other indicators of such failures and most often result in a blank page being displayed. Note that if you are logged in to Application Builder as a developer, an error messages will display.

  • Specifying the process by name locates the first process with the specified (case-preserved) name.

Application Process Example

A shopping cart application is a good example of when you might use an application process. For example, suppose you need to display the contents of a user's shopping cart with each page view. To accomplish this, you create a region on page zero of your application that displays the values of the application-level items TOTAL_CART_ITEMS and TOTAL_PURCHASE_PRICE.

Instead of writing a process for each page to set the values of TOTAL_CART_ITEMS and TOTAL_PURCHASE_PRICE, you could write an application process of type On Load: Before Header to compute these values. Then, the Application Express engine would execute the process on each page as it renders the application. As a result, each page, would display the most current values for TOTAL_CART_ITEMS and TOTAL_PURCHASE_PRICE.

Creating an Application Process

To create an application process:

  1. Navigate to the Shared Components page:

    1. On the Workspace home page, click Application Builder.

    2. Select an application.

    3. On the Application home page, click Shared Components.

      The Shared Components page appears.

  2. Under Logic, select Application Processes.

    The Application Processes page appears.

  3. Click Create.

  4. For Identification:

    1. Name - Enter a name for the application process.

    2. Sequence - Specify the sequence number for this process. The sequence number determines the order in which the process is evaluated relative to other processes that execute at the same point.

    3. Point - Identify the point during the processing of each page in the application that this process would run. Note the option, On Demand, only runs when requested by a page process.

    4. Click Next.

  5. For Source:

    1. Process Text - Enter the text that is to be the source of your process. Processor of type PL/SQL will be wrapped with a Begin and End;.

    2. Error Message - Enter the error message that displays if the process raises an error. See "Creating Application Process Error Messages".

    3. Click Next.

  6. For Conditionality:

    1. Condition Type - Select a condition type that must be met in order for this process to execute.

    2. Expression 1 and Expression 2 - Use these attributes to conditionally control whether the process executes. Enter values in this attribute based on the specific condition type you select. The process will execute if the specified condition is met.

    3. Click Create Process.

About the Application Process Page

Once you create an application process, it appears on the Application Processes page. You control how the page displays by making a selection from the View list. Available options include:

  • Icons (the default) displays each process as a large icon. To edit a process, click the appropriate icon.

  • Details displays each application process as a line in a report. To edit a process, click the name.

Editing Application Process Attributes

To edit an existing page process:

  1. Navigate to the Shared Components page:

    1. On the Workspace home page, click Application Builder.

    2. Select an application.

    3. On the Application home page, click Shared Components.

      The Shared Components page appears.

  2. Under Logic, select Application Processes.

    The Application Processes page appears.

  3. Click the process name.

  4. Edit the appropriate attributes. For more information, see item Help and the sections that follow.

  5. Click Apply Changes.

Creating Application Process Error Messages

If a process raises an error, you can define an error messages that displays to the user. How the error message displays depends upon the processing point. For processes with a processing point of On Submit - Before Computation and Validations or On Submit - After Computations and Validations, you can specify whether the error message displays inline on the current page (the default) or on a separate page. For all other application processes, error messages display on a separate error page.

To create an application process error message:

  1. Navigate to the Shared Components page:

    1. On the Workspace home page, click Application Builder.

    2. Select an application.

    3. On the Application home page, click Shared Components.

      The Shared Components page appears.

  2. Under Logic, select Application Processes.

    The Application Processes page appears.

  3. Click the process name.

  4. Scroll down to Source.

  5. In Process Error Message, enter the message that displays when an unhandled exception is raised. See item Help for more details on supported substitution strings for both success and error messages.

  6. For processes with a processing point of On Submit - Before Computation and Validations or On Submit - After Computations and Validations, you can specify where the error message displays.

    From Error message display location, select one of the following:

    • Inline in Notification - Error displays inline on the page in the "notification" area (defined as part of the page template). This is the default setting for new processes.

    • On Error Page - Error displays on a separate error page.

      If the application contains a manually created tabular form (using APEX_ITEM calls in the SQL statement), select On Error Page. Otherwise, changes made by the user are discarded when the page is re-rendered. When errors are displayed on a separate error page, the user can use the browser's Back button to preserve the entered values.

  7. Click Apply Changes.

Viewing the Application Processes History Report

After you create an application process, you can access the Application Processes History reports. This report displays a history of recently changed application processes by date.

To access application processes reports:

  1. Navigate to the Workspace home page.

  2. Click Application Builder.

  3. Select an application.

  4. On the Application home page, click Shared Components.

  5. Under Logic, select Application Processes.

  6. Select the History tab at the top of the page.

  7. You can customize the appearance the page using the Search bar at the top of the page. Available controls include:

    • Search icon - Resembles a magnifying glass. Click this icon to narrow your search to only specific columns. To search all columns, select All Columns.

    • Text area - Enter case insensitive search criteria (wildcard characters are implied) and then click Go.

    • Go button - Executes a search or applies a filter.

    • View icons. Use this control to toggle between Icons, Report, or Details views. To change the view, click one of the following:

      • View Icons (default) displays each process as a large icon.

      • View Report displays each process as line in a report.

    • Actions menu - Displays the Actions menu. Use this menu to customize the report view. See "About the Actions Menu".