Previous Next JavaScript must be enabled to correctly display this content

## 20.6 About Using Workflows in Page Processes

Add the new Workflow Process Type plug-in to a page to expose workflow operations.

The Workflow Process Type plug-in is a new Process Type available in the processing section of application pages. This plug-in exposes specific operations for workflows.

- Starting a Workflow Instance
  Start a workflow instance with the Workflow Start page process.
- Terminating a Workflow Instance
  Terminate a running workflow with the Workflow Terminate page process.
- Suspending a Workflow Instance
  Suspend a running workflow with the Workflow Suspend page process.
- Resuming a Workflow Instance
  Resume a suspended workflow with the Workflow Resume page process.
- Retrying a Workflow Instance
  Retry a faulted workflow with the Workflow Retry page process.

Parent topic: Managing Workflows and Tasks

### 20.6.1 Starting a Workflow Instance

Start a workflow instance with the Workflow Start page process.

For APEX to create tasks, you must define a Workflow Process Type plugin, and add it to a page process. When the page process runs, APEX creates a new workflow instance based on the workflow definition. In order to use this process, at least one workflow definition must exist as a shared component in the application.

To start a workflow instance:

1. View the page in Page Designer.
   1. On the Workspace home page, click the App Builder icon.
   2. Select an application.
   3. Select a page.
2. In either the Rendering or Processing tab, locate the node where the process must occur. Right-click and select Create Process.
3. Under Identification:
   1. Name - Specify the name of the process.
   2. Type - Select Workflow.
4. Under Settings:
   1. Type - Select Start.
   2. Definition - Select the workflow definition.
5. Bind the Workflow Parameters to values.
   These values can be Static Content, Page Item (with optional format mask), SQL Query, Expression, Function Body, Default, and Null. You only need to assign values to required parameters.
6. (Optional) Under Settings, specify the Details Primary Key by selecting the page item that contains the value of the Primary Key of the Source Table specified in the corresponding workflow version.
7. (Optional) Under Settings, specify the Workflow ID Item - If the ID of the Workflow Instance that gets created must be returned into a page item, specify the page item here.
8. Configure the rest of the Process.
   For more information, see Creating Page Processes.
9. Set the Page Process Parameters.
   If the Workflow Definition has parameters specified, these appear in the Process Tree on the page. Parameters can be set to static values or page items. If a parameter is not required, it can be left as `Null`. If a parameter is marked `Required` in the Workflow Definition, it must be set in the process. If a required parameter is not set, there is an error when saving the page.
10. Click Save.

Parent topic: About Using Workflows in Page Processes

### 20.6.2 Terminating a Workflow Instance

Terminate a running workflow with the Workflow Terminate page process.

Terminating a workflow that was invoked from another workflow also terminates the parent workflow if the parent workflow is configured to wait for the current workflow to complete.

To terminate a workflow instance:

1. View the page in Page Designer.
   1. On the Workspace home page, click the App Builder icon.
   2. Select an application.
   3. Select a page.
2. In either the Rendering or Processing tab, locate the node where the process will occur. Right-click and select Create Process.
3. Under Identification:
   1. Name - Specify the name of the process.
   2. Type - Select Workflow.
4. Under Settings:
   1. Type - Select Terminate.
   2. Workflow ID Item - Specify the page item that contains the workflow instance ID.
5. Configure the rest of the Process.
   For more information, see Creating Page Processes.
6. Click Save.

Parent topic: About Using Workflows in Page Processes

### 20.6.3 Suspending a Workflow Instance

Suspend a running workflow with the Workflow Suspend page process.

To suspend a workflow instance:

1. View the page in Page Designer.
   1. On the Workspace home page, click the App Builder icon.
   2. Select an application.
   3. Select a page.
2. In either the Rendering or Processing tab, locate the node where the process will occur. Right-click and select Create Process.
3. Under Identification:
   1. Name - Specify the name of the process.
   2. Type - Select Workflow .
4. Under Settings:
   1. Type - Select Suspend.
   2. Workflow ID Item - Specify the page item that contains the workflow instance ID.
5. Configure the rest of the Process.
   For more information, see Creating Page Processes.
6. Click Save.

Parent topic: About Using Workflows in Page Processes

### 20.6.4 Resuming a Workflow Instance

Resume a suspended workflow with the Workflow Resume page process.

To resume a workflow instance:

1. View the page in Page Designer.
   1. On the Workspace home page, click the App Builder icon.
   2. Select an application.
   3. Select a page.
2. In either the Rendering or Processing tab, locate the node where the process will occur. Right-click and select Create Process.
3. Under Identification:
   1. Name - Specify the name of the process.
   2. Type - Select Workflow.
4. Under Settings:
   1. Type - Select Resume.
   2. Workflow ID Item - Specify the page item that contains the workflow instance ID.
   3. (Optional) Activity Static ID Item - Specify the static ID of the activity where the workflow resumes.
5. Configure the rest of the Process.
   For more information, see Creating Page Processes.
6. Click Save.

- Resuming Suspended Workflows at Any Activity
  Learn about resuming suspended workflows at any activity.

Parent topic: About Using Workflows in Page Processes

#### 20.6.4.1 Resuming Suspended Workflows at Any Activity

Learn about resuming suspended workflows at any activity.

A suspended workflow can be resumed at any activity in the workflow by using `APEX_WORKFLOW.RESUME` and specifying the workflow instance ID and the static ID of the activity the workflow should resume with. The default is the current activity, which is the activity where the workflow was suspended.

If the workflow is resumed at a different activity than the current activity, the current activity is terminated and the workflow resumes at the specified activity.

Example 20-1 Exposing the Workflow Activity ID in the Workflow Admin Console

To expose the workflow activity ID in the Workflow Admin Console, add a new page item `P<X>_ACTIVITY_STATIC_ID` of type Select List in the Dialog Footer of the page with the following SQL query:

    select wa.name      as name,
           wa.static_id as value
      from apex_appl_workflow_activities wa,
           apex_appl_workflow_versions   wv,
           apex_workflows                wf$
     where wf$.workflow_id          = :P<X>_WORKFLOW_ID
       and wf$.workflow_version_id  = wv.version_id
       and wv.version_id            = wa.version_id
       and wv.workflow_static_id    = wa.workflow_static_id

and then modify the Resume processing element to take the page item value of `P<X>_ACTIVITY_STATIC_ID` for item Activity Static ID.

With this, a business administrator can select the static ID of the activity from a dropdown list and click Resume to resume the workflow at the specified activity.

Parent topic: Resuming a Workflow Instance

### 20.6.5 Retrying a Workflow Instance

Retry a faulted workflow with the Workflow Retry page process.

To retry a workflow instance:

1. View the page in Page Designer.
   1. On the Workspace home page, click the App Builder icon.
   2. Select an application.
   3. Select a page.
2. In either the Rendering or Processing tab, locate the node where the process will occur. Right-click and select Create Process.
3. Under Identification:
   1. Name - Specify the name of the process.
   2. Type - Select Workflow.
4. Under Settings:
   1. Type - Select Retry.
   2. Workflow ID Item - Specify the page item that contains the workflow instance ID.
5. Configure the rest of the Process.
   For more information, see Creating Page Processes.
6. Click Save.

Parent topic: About Using Workflows in Page Processes