Understanding Background Execution
Workflows run in a background session without page session state or a logged-in user.
The APEX engine manages the progress of workflow instances asynchronously in the background. It processes each instance’s next activity in a distinct engine session with no logged-in user. A workflow engine session is also different from the user session created for each end user of your application’s pages.
By design, two consequences are:
-
a workflow instance has no access to session state values from application pages, and
-
evaluating
APP_USERreturnsnobodyin a workflow.
Therefore, any value your workflow depends on needs to be:
-
A built-in APEX workflow substitution (e.g.
APEX$WORKFLOW_INITIATOR), -
An Additional Data column,
-
Saved in a table, so an activity can query it,
-
Passed as a parameter value to the workflow instance at start time,
-
Stored in a workflow variable by an earlier activity, or
-
Saved to an updatable task parameter accessible via
APEX_HUMAN_TASKAPI.