25.1.9.1.2 Associating a Table with a Task

Associate a task with a table or query so task logic can reference related row data.

An end-user task often relates to a business entity in your application data model. A task definition models that work item, and a task instance represents one example of it for a particular row in that business entity's table. Task assignment and your actions that react to task status changes tend to reference or modify data in this related business entity row.

APEX simplifies this common usage pattern by letting you:
  • configure the Actions Source table and primary key column in a task definition, and
  • supply a Details Primary Key value of a corresponding row when creating a task instance.

Then, wherever your app creates a new task instance, remember to supply the primary key value of the business entity row to which the new task relates.

This brief investment of time delivers a strong productivity payoff. Without writing any code or queries, you can reference the business entity row's details anywhere in the task definition using any column name. Just use this syntax:
  • &NAME. in text substitutions, and
  • :NAME in code and queries.

For example if your Actions Source table's primary key column is ID, then you can reference :ID in action PL/SQL code or participant assignment expressions or queries. In email notifications use the substitution &ID. instead.

Tip:

For even more powerful automatic data access in your task definition, change the Actions Source type from Table to SQL Query. Your query typically includes a primary table and its primary key column, and can optionally join in any other related data. It must return exactly one row. If your task accepts a Details Primary Key, your WHERE clause can reference its value using the :APEX$TASK_PK bind variable. Then throughout the workflow you can use &NAME. or :NAME notation to reference the value of any column in your Actions Source query's SELECT list.