Sunday, September 20, 2015

How to progress Errored workflow using back end api

DECLARE
   CURSOR c1
   IS
     SELECT c.INSTANCE_LABEL,a.line_id
        FROM oe_order_lines_all a,
        apps.wf_item_activity_statuses b,
        apps.wf_process_activities c
       WHERE header_id = 602953547
       and b.item_key = to_char(a.line_id)
       and b.item_type ='OEOL'
       and b.activity_status='ERROR'
       and b.process_activity = c.instance_id;

BEGIN
   FOR c1_rec IN c1
   LOOP
      wf_engine.handleerror (
         'OEOL',
         TO_CHAR (c1_rec.line_id),
         C1_REC.INSTANCE_LABEL,
         'RETRY',
         NULL
      );
   END LOOP;
   commit;
EXCEPTION
   WHEN OTHERS
   THEN
      DBMS_OUTPUT.put_line (SQLERRM);
END;