Morning all,
I’ve recently had a request to delete subsequent approvals if a specific approval has been rejected. e.g. below: If the PROC REVIEW Request is rejected then the 3 approvals below would be deleted.
I’ve managed to create a custom event as per below, which executes a package to handle the removal:
SQL Package:
PROCEDURE Remove_Supplier_Approvals(i_Key_Ref VARCHAR2) IS
PRAGMA AUTONOMOUS_TRANSACTION;
-- p0 -> __lsResult
p0_ VARCHAR2(32000) := NULL;
-- p4 -> __sAction
p4_ VARCHAR2(32000) := 'DO';
/*Created by RK to automatically remove values from the approvals screen*/
cursor GET_DATA IS
Select distinct
OBJID,
OBJVERSION from approval_routing
where LU_NAME = 'SupplierInfoGeneral'
and KEY_REF = i_Key_Ref
and description in ('Supp Reactivation - Acc Payable Review',
'Supp Reactivation - Procurement Confirm',
'Supp Reactivation - Reactivate Account')
and APPROVAL_STATUS is null
;
BEGIN
--IFSAPP.Language_SYS.Set_Language('gb'); -- This requires logged in user to have privileges to Language_SYS.Set_Language
for C_GET_DATA in GET_DATA LOOP
approval_routing_api.Remove__( p0_ , C_GET_DATA.objid , C_GET_DATA.OBJVERSION , p4_ );
end loop;
COMMIT;
However, when this executes I get the deadlock detected error as it’s attempting to update the same package twice.
Any ideas on how to get around this or if there’s some functionality already in IFS that can complete this task?
Kind Regards,
RK