25.1.9.1.4.2 Assigning Participants Dynamically
Assign task participants dynamically with queries, expressions, or functions that return case-sensitive usernames.
To assign task participants dynamically, use a participant Value Type of
SQL Query, Function Body, or Expression. When using the SQL
Query option, your single column SELECT list returns one
case-sensitive username per row. For the Function Body or Expression
options, return a comma-separated list of case-sensitive usernames.
Your query, function, or expression can use bind variable syntax to reference task parameter values, action source column names, application items, or other APEX substitution strings.
Tip:
Workflows execute in the background where there is no "logged-in username". So the APP_USER substitution returns nobody in a workflow context. Use APEX$WORKFLOW_INITIATOR to reference the username that initiated the workflow, or APEX$TASK_INITIATOR for the username that initiated the task. If neither of these is the user you need, define a workflow parameter or task parameter to accept a username for other purposes.
IN parameters:your_app_pkg.owners_for_task(:APEX$TASK_ID, :APEX$TASK_PK)By passing the value of pre-defined bind variables like APEX$TASK_ID and APEX$TASK_PK, your generic function can lookup related information from APEX dictionary views like APEX_TASKS and from your application table using the primary key value. If needed, you can join in task definition information from the APEX_APPL_TASKDEFS view, using the value of the TASK_DEF_STATIC_ID column in APEX_TASKS.
Caution:
Participant usernames are case-sensitive. If :APP_USER returns DAVID, then use DAVID.
Parent topic: Determining Task Participants