Wednesday, January 12, 2011

HR Workflow Process - Pending Even after the Process is Killed

As per Oracle, Oracle HR Leave of Absence SHOULD NOT be CANCELLED, but they should be REJECTED from the supervisor level. But practically, users always asks to close or cancel their Leave Workflow which is entered wrongly before their supervisor takes action against it. As a Workflow and System Administrator, this workflow process can be Killed or ended. Once this is done, all the notifications related to that Workflow will be Closed with FORCE. BUT if the user tries to create the leave again with the same dates sometimes there will be an error something like the dates are overlapping or leave of absence for this date is already.  The better approach to overcome this error to :


If you want to cancel a workflow, you have to do the following

-- Workflow Administrator

-- Status monitor

-- Search for workflow process

-- select a process and click on activity history

-- select the node "V5.0 Notify Approver with Correction" and click on skip

-- Select "Reject" in the pop list as result and apply.

The reason is , SSHR does not handle "cancel" action on a workflow process.


In case the workflow is already canceled and if the user wants to apply the leave for the same START DATE or his second of Leave of Absence is between those cancelled Leave Date then the Oracle HR LOA system thinks that the user applying for the LOA for the second time with in the same range of the Date and it will through an error and not allow the user to Apply the Leave. Even the Leave of Absence Screen shows the Previous Leave and with status PENDING FOR APPROVAL from their Supervisor.


This can be resolved in 2 steps:


1) Run the Complete Defunct HR Workflow Processes with the ITEMTYPE-HR and select all the default parameters. This should clear all the Workflow Status.


2) Even if the Problem is not resolved then need to perform the rollback the pending transaction from the back end.


Steps as follows:

-- query hr_api_transactions using creator_person_id, creation_date ,

process_name columns

-- note the the transaction_id for the cancelled transaction

now, call the following from back end :

execute hr_transaction_api.rollback_transaction

( p_transaction_id => sshr_transaction_id ,

 p_validate => false );

commit;

This removes the cancelled, hanging transaction.

A Handy script which will be very useful:


SELECT    'exec hr_transaction_api.rollback_transaction( p_transaction_id => '
       || hat.transaction_id
       || ', p_validate => false );'
  FROM hr_api_transactions hat, wf_notifications wn
 WHERE hat.item_key = wn.item_key AND wn.status = 'CANCELED'