Home > Forum > Actions > Cancelling sub-workflows, IF the main workflow has been cancelled

Cancelling sub-workflows, IF the main workflow has been cancelled
0

Hello,

The question I have sounds very easy, how do I cancel all the remaining subworkflows that are not already "answered" to?

Parent - 12345 - will wait for all 3 subworkflows to be done
Child 1 - 12346 - finished
Child 2 - 12347 - in progress
Child 3 - 12348 - in progress

All I need is, if I cancel 12345, then 12347 and 12348 will automatically be classed as finished. Can you help at all?
Thank you!!

MVP

Hi Joanna,

this is quite simpel, if you know how to implement it.

You will need to have a cancel path on each step of the child workflow from where it could move to cancel.
In the parent workflow cancel path you will add a "move workflow (sql)" function.
Instead of defining a fixed path I would define the path dynamically.

Pseudo code:
select WFD_ID
case
when WFD_STPID = "In progress step id" then "Cancel path of in progress step"
when WFD_STPID = "Other step id" then "Cancel path of other step"
else -1 end PATH_ID
from WFElements
where WFD_WFDID = 12345

I haven't checked the name of the PATH_ID, you can click on the blue info icon to verify it.

Best regards,
Daniel