Remove active flow by script

I would like to check if it is possible to remove an active flow by script rather than drop stuck flow.
The use case is: A flow is active now, but the user jumping to another flow. I do not want this flow continue but I do not want it to be dropped due to flow stuck because it is a prompt flow which should be triggered every time when the business flow completed. If it is dropped due to stuck, then this flow will be not be resumed after user finished another business flow.

Best regards

Hi @sc_chatbot ,

let’s see if the following script helps you:

List<List> activeFlows = _.activeFlows;
for (List activeFlow : activeFlows) {
	for (def x : activeFlow) {
		if (!=_.getThisFlow().id){

The code will remove all flows from the flow stack besides the current one from which you are calling this script.
Does this help you in your use case?

Thanks for your help.
I found another way to solve my issue and will try your solution later.

Best regards

1 Like

Welcome, looking forward to hear if and how all worked out for you :slight_smile:
Have a nice weekend!