25.1.9.1.11.4.1 Updating Entity Columns on Complete

Update the related business entity row when an approval task completes.

Assume a Salary Change task definition uses the primary business entity table EMP as its Actions Source table. The task definition defines parameters like:
  • P_PROPOSED_SALARY – to store the suggested new employee monthly pay, and
  • P_MOTIVATION – to let the requester summarize the reason for the change.

The task definition defines a subject like the following, referencing the value of the Action Source table ENAME column and the parameter name.

Review &ENAME. Salary Change to &P_PROPOSED_SALARY.
When a Salary Change task completes successfully, it has an outcome of either APPROVED or REJECTED. Your Execute Code action on the Complete event needs to update the SAL column to the P_PROPOSED_SALARY value for EMP table row related to the task instance. Your code looks like:
-- If approved, update sal using Action Table EMPNO column value
if :APEX$TASK_OUTCOME = 'APPROVED' then 
   update emp
      set   sal = :P_PROPOSED_SALARY
    where empno = :EMPNO;
end if;