Wednesday, February 25, 2015

Query to get the Workflow Status

  SELECT wfs.item_key,
         wfa.display_name process,
         wfa1.display_name activity,
         --apps.wf_core.activity_result(wfa1.result_type,wfs.activity_result_code)
         -- result,
         lkp.meaning act_status,
         wfs.notification_id notif,
         wfp.process_name i_process,
         wfp.activity_name i_activity,
         TO_CHAR (wfs.begin_date, 'dd-mon-rr_hh24:mi:ss') begin_d,
         TO_CHAR (wfs.end_date, 'dd-mon-rr_hh24:mi:ss') end_d,
         wfs.error_name error_name,wfs.due_date
    FROM apps.wf_item_activity_statuses wfs,
         apps.wf_process_activities wfp,
         apps.wf_activities_vl wfa,
         apps.wf_activities_vl wfa1,
         apps.wf_lookups lkp
   WHERE     1 = 1
         AND wfs.item_type = 'OEOH'
         AND wfs.item_key = TO_CHAR (342168)
         AND wfs.process_activity = wfp.instance_id
         AND wfp.process_item_type = wfa.item_type
         AND wfp.process_name = wfa.name
         AND wfp.process_version = wfa.version
         AND wfp.activity_item_type = wfa1.item_type
         AND wfp.activity_name = wfa1.name
         AND wfa1.version =
                (SELECT MAX (version)
                   FROM apps.wf_activities wf2
                  WHERE     wf2.item_type = wfp.activity_item_type
                        AND wf2.name = wfp.activity_name)
         AND lkp.lookup_type = UPPER ('wfeng_status')
         AND lkp.lookup_code = wfs.activity_status
ORDER BY wfs.item_key, wfs.begin_date, execution_time;



No comments:

Post a Comment

Best Blogger TipsGet Flower Effect