An Approval Task exists in the Task Persistence database in the tasksession12_5 table, similarly to any other Administrative Task.
A workitem/job exists in the WPDS database (installed together with the other IM DBs) in the WP_PROCI table.
The are links between the TP DB and the WPDS DB as follows:
The unique identifier of the Approval Task is tasksession12_5.tasksessionid, which will have a match in WP_PROCI.name column.
Therefore, the flow of retrieval will go as follows:
<Please see attached file for image>
2. Get the proci_id of the job associated to the Approval Task:
SELECT PROCI_ID FROM WP_PROCI WHERE NAME = <tasksessionid from step 1>
<Please see attached file for image>
3. SELECT ACTI_ID FROM WP_WORK_ITEM WHERE PROCI_ID = <proci_id from step 2>
<Please see attached file for image>
1. Get the tasksessionid of the approval task (this can be retrieved via BLTH or PX task session attribute)