Previous Next JavaScript must be enabled to correctly display this content

## 15.4 Understanding Application Processes

Create an application process to run a block of PL/SQL logic at a specific point 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.

Tip:

To learn more about execution behavior in the case of a validation error, see What Happens When a Validation Fails?

- On Demand Application Processes
  On Demand processes are useful when you have PL/SQL logic that you would like to run from different execution points across multiple pages.
- About Application Processes that Execute On New Instance
  Processes with a Process Point of On New Instance enable you to retrieve information once within a user's session.
- About Running an On Demand Process from a Page Request
  Run an On Demand process from a page request.
- Example: Application Process
  View an application process example.
- Creating an Application Process
  Create an application process from Shared Components.
- Editing Application Process Attributes
  Edit application process attributes from Shared Components.
- Copying or Subscribing to Application Processes
  Copy application processes from the current application or from another application. When copying an application process from another app, you can also subscribe to it.
- Subscribing to an Application Process
  Subscribe to an application process on the Application Processes, Edit page.
- Creating Application Process Error Messages
  Learn how to define application process error message.
- Viewing the Application Processes History Report
  To view the Application Process History report.

Related Topics

- Understanding Page Processes

Parent topic: Managing Computations, Validations, and Processes

### 15.4.1 On Demand Application Processes

On Demand processes are useful when you have PL/SQL logic that you would like to run from different execution points across multiple pages.

An On Demand process is special type of application process which has a Process Point of On Demand, is of type PL/SQL, and executes when called from a page-level On Demand process or from an Ajax call from the browser.

On Demand processes should typically be created on a page and not at the application-level. On Demand processes created at the application-level are created with an initial authorization scheme of Must Not Be Public User to prohibit the processes from being invoked from users in unauthenticated sessions.

See Also:

Creating Page Processes

Parent topic: Understanding Application Processes

### 15.4.2 About Application Processes that Execute On New Instance

Processes with a Process Point of On New Instance enable you to retrieve information once within a user's session.

Typically an application process runs at the same point across multiple pages in an application. Processes having a Process Point of On New Instance are the exception. These types of processes are useful when you only need to retrieve information once within a user's session. For example, if the application items do not depend on the logged in user, you can initialize them using the Process Point On New Instance. To look up information that depends on the user, you can also use After Authentication.

If you configure applications to share the same session by setting the same cookie name in the authentication scheme, On New Instance and After Login, the application processes fire whenever Oracle APEX first processes a request for the application (that is, On New Instance), or processes a request of an authenticated user for the application (that is, After Authentication).

Parent topic: Understanding Application Processes

### 15.4.3 About Running an On Demand Process from a Page Request

Run 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 APEX 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 App Builder as a developer, an error messages displays.
- Specifying the process by name locates the first process with the specified (case-preserved) name.

See Also:

Clearing Session State

Parent topic: Understanding Application Processes

### 15.4.4 Example: Application Process

View an application process example.

A shopping cart application is a good example of when you might use an application process. For example, to display the contents of a user's shopping cart with each page view, 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 APEX 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`.

See Also:

Creating a Global Page to Display Components on Every Page

Parent topic: Understanding Application Processes

### 15.4.5 Creating an Application Process

Create an application process from Shared Components.

To create an application process:

1. Navigate to the Shared Components page:
   1. On the Workspace home page, click App Builder.
   2. Select an application.
   3. On the Application home page, click Shared Components.

      The Shared Components page appears.

2. Under Application Logic, select Application Processes.

   The Application Processes page appears.

3. Click Create.
4. For Identification:
   1. Name - Enter a name to identify 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 point Ajax Callback will only fire when requested by a page process.
   4. Click Next.
5. For Source:
   1. Language - Select a language that is used to evaluate the entered programming code.
   2. Code - Enter the code of your application process.
   3. Do not validate code (parse code at runtime only) - Select if applicable.
   4. Click Next.
6. For Conditionality:
   1. Condition Type - Select a condition type that must be met in order for this process to execute. Note that the UI changes slightly depending upon the selected Condition Type.
   2. Expression 1 - Use this attribute to conditionally control whether or not a component is rendered or processed. Enter values in this attribute based on the selected condition type. The component will be rendered or processed if the specified condition is met.
   3. Click Create Process.

See Also:

Creating Application Process Error Messages

Parent topic: Understanding Application Processes

### 15.4.6 Editing Application Process Attributes

Edit application process attributes from Shared Components.

To edit an existing page process:

1. Navigate to the Shared Components page:
   1. On the Workspace home page, click App Builder.
   2. Select an application.
   3. On the Application home page, click Shared Components.

      The Shared Components page appears.

2. Under Application Logic, select Application Processes.

   The Application Processes page appears.

3. Click the process name.
4. Edit the appropriate attributes. For more information, see field-level Help.
5. Click Apply Changes.

Parent topic: Understanding Application Processes

### 15.4.7 Copying or Subscribing to Application Processes

Copy application processes from the current application or from another application. When copying an application process from another app, you can also subscribe to it.

Tip:

Subscriptions enable developers to reuse shared components across several applications in a workspace. To learn more about subscriptions, see Using Shared Component Subscriptions.

Note:

When copying an application process from another app, shared component dependencies are automatically resolved. To learn more, see About the Logic Resolving Dependencies.

To copy or subscribe to an application process:

1. Navigate to the Application Processes page.
   1. Navigate to the Workspace home page.
   2. Click the App Builder icon.
   3. Select an application.
   4. On the Application home page, click Shared Components.
   5. Under Application Logic, click Application Processes.

      The Application Processes page appears. Note that the report includes the following columns: Subscribed From, Subscription Status, and Subscribers.

2. To copy an application process within the current application:
   1. Search for the application process and click Copy in the Copy column.

      The Copy Application Process Wizard appears.

   2. New Application Process Name - Enter the name of the application process.
   3. Click Copy Application Process.
3. To copy an application process from another application:
   1. From the Tasks region, click Copy from another app.

      The Copy Application Process appears.

   2. Application - Select the application from which you want to copy.
   3. Copy Application Process - Select the application process to copy.
   4. Subscribe - Set this flag to On to subscribe to the application process.
   5. Click Copy Application Process.

Parent topic: Understanding Application Processes

### 15.4.8 Subscribing to an Application Process

Subscribe to an application process on the Application Processes, Edit page.

Subscriptions enable developers to reuse shared components across several applications in a workspace. To learn more about shared component subscriptions, see Using Shared Component Subscriptions.

Tip:

You can also subscribe to a search configuration by copying it and then subscribing. See Copying or Subscribing to Application Processes.

To subscribe to an application process:

1. Navigate to the Application Processes page.
   1. Navigate to the Workspace home page.
   2. Click the App Builder icon.
   3. Select an application.
   4. On the Application home page, click Shared Components.
   5. Under Application Logic, click Application Processes.

      The Application Processes page appears. Note that the report includes the following columns: Subscribed From, Subscription Status, and Subscribers.

2. Select an application process.
   The Application Processes, Edit page appears.
3. To subscribe to an application process:
   1. Find the Subscription region.
   2. Subscription, Subscribe From - Select a master application process to subscribe to and click Apply Changes.

      The subscribed component is automatically refreshed from the selected master.

4. To refresh a subscribed application process:
   1. Find the Subscription region.
   2. Subscription, Refresh Application Process - If the application process is already subscribed, click Refresh Application Process.
5. To unsubscribe from a subscribed application process:
   1. Find the Subscription region.
   2. Subscription, Unsubscribe - Click Unsubscribe.

Parent topic: Understanding Application Processes

### 15.4.9 Creating Application Process Error Messages

Learn how to define application process error message.

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 App Builder.
   2. Select an application.
   3. On the Application home page, click Shared Components.

      The Shared Components page appears.

2. Under Application Logic, select Application Processes.

   The Application Processes page appears.

3. Click the process name.
4. Edit the following attributes:
   1. Source, Process Error Message - Enter the message that displays when an unhandled exception is raised.
   2. Error message display location - Applies to processes with a processing point of `On Submit - After Page Submission - Before Computation and Validations` or `On Submit - After Page Submission - After Computations and Validations`, you can specify where the error message displays.

      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).

      - 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.

5. Click Apply Changes.

See Also:

Editing Application Process Attributes

Parent topic: Understanding Application Processes

### 15.4.10 Viewing the Application Processes History Report

To view the Application Process History report.

The Application Process History report displays recent modifications made to application processes.

To view

1. Navigate to the Shared Components page:
   1. On the Workspace home page, click App Builder.
   2. Select an application.
   3. On the Application home page, click Shared Components.

      The Shared Components page appears.

2. Under Application Logic, select Application Processes.

   The Application Processes page appears.

3. Select the History tab at the top of the page.
4. You can customize the appearance the page using the Search bar at the top of the page. Available controls include:

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

   - Text area - Enter case insensitive search criteria (wildcard characters are implied) to search for a process by name and click Go.

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

   - Actions menu - Use the Actions menu to customize the report view.

See Also:

About the Actions Menu

Parent topic: Understanding Application Processes