Search This Blog

Thursday 23 July 2015

Fetching Task Instance key from OIM Database using Task Name

Below query can be used to fetch task instance key for the task from OIM Database using the process instance key and task name as input parameters:

SELECT sch.sch_key FROM osi, sch,mil WHERE mil.mil_key = osi.mil_key AND osi.sch_key = sch.sch_key AND mil.mil_name='Task Name' AND orc_key='Process Instance Key';

To fetch the latest or last task instance key use the below query:

SELECT max(sch.sch_key) FROM osi, sch,mil WHERE mil.mil_key = osi.mil_key AND osi.sch_key = sch.sch_key AND mil.mil_name='Task Name' AND orc_key='Process Instance Key';

Eg: For a user, we have the create user task for which we want to fetch the Task Instance Key then we can update the query as below:

SELECT max(sch.sch_key) FROM osi, sch,mil WHERE mil.mil_key = osi.mil_key AND osi.sch_key = sch.sch_key AND mil.mil_name='Create User' AND orc_key='Process Instance Key';

To view the list of task available, hit the below query:
select  * from mil;

No comments:

Post a Comment