You can find the solution here
BeforeProvisioning Rule for Oracle EPM to delete the account while removing last entitlement - Identity Security Cloud (ISC) / ISC Discussion and Questions - SailPoint Developer Community