Cancel a Workflow Task through an EventHandler
Hello there,
As the title implicates, I am trying to cancel the current running workflow task through a Business Rule (Transformation EventHandler). My workflow is the ETL process (Import, Validate, Load), I wrote an event handler to catch all rejects from 'Transformation' and 'Validation' steps then updates the Transformation Rules to ByPass these rejects.
My problem is the following:
- After positioning myself on the event: BREventOperationType.Transformation.ValIntersect.FinalizeValidateIntersect, I execute a code that catches the validation rejects & updates the transformation rules accordingly. However, when I 'Revalidate/ReTransform' I get an error saying [ Workflow Unit already has a running task [ValidateTransformation - WP#TestWF.Import:S#Actual:T#2022M10], cannot start task [ValidateIntersections - WP#TestWF.Import:S#Actual:T#2022M10] until current task completes.]
Is it possible to modify a task's status to 'Completed' so I can relaunch the validation a second time ? If not what might be the best approach ?
Thanks in advance