Friday, August 31, 2012

Instance Migration Scripts - Workflows

--  Check Workflow Activity Status
  SELECT COUNT (1)
        IN ln_completed_lines
        FROM wf_item_activity_statuses a,
             wf_process_activities b,
             oe_order_lines_all c

       WHERE a.process_activity = b.instance_id
         AND b.process_item_type = 'OEOL'
         AND b.activity_name = 'XYZ_SO_EC_HOLD'
         AND activity_status = 'COMPLETE'
         AND item_key = _CHAR (c.line_id)
         AND c.header_id = pin_order_header_id

 -- Run workflow background program from DB
BEGIN
wf_engine.Background (itemtype=>'OEOH',
                      minthreshold => NULL,
                      maxthreshold => NULL,
                      process_deferred => TRUE,
                      process_timeout=> FALSE,
                      process_stuck => NULL);
END;