Msg.reset inside subflow not working on delay

I think part of your problem may be that you have the wrong mental image of subflows. Don't think of it as something you call (any more than you call a Change node). When you place an instance of the subflow on a flow it is conceptually like placing a copy of all the nodes in the subflow on the page in a little box. Each flow where you place the subflow gets its own copy of the internal nodes. So when you pass a message to your subflow in flow A it goes through the subflow nodes that are in that flow, and when you do it in flow B the message goes through a different copy of the nodes. It isn't actually quite like that in the implementaion, but conceptually that is what happens. The only way you can cancel the delay in X(A) is by sending a message to the node in that copy of the subflow, you cannot do it by passing a message into the copy of the nodes in flow B. You could achieve it by using global context to pass messages between the subflows, but that would be a hack which would probably bite you at some stage in the future.

Did you investigate the possibility of using Link Call nodes rather than subflows as suggested earlier? It sounds as if that may better match your mental image of what you want to do.

I just finished setting up a test of what I'm trying to do using link call and after adding the catch for the timeout I think it is going to work correctly. Fortunately in both the flows that would use the link call there is no further action needed after the link call so it looks like just catching the timeout is sufficient.

Thanks everyone for all the help.

1 Like

Excellent!

The thing to remember here, is that a subflow is geared to be more a 'reusable' logic block.
2 copies of your subflow in your main flow, do not share context - each has its own.

Personally, I think subflows are slightly mis-labelled.
I tend to think of them as 'blueprints' or as above, 'reusable' logic blocks.

In my second test I found a gotcha - all my "actions" are done as subflows and there are a lot of them. LinkCalls do not work from subflows only flows. Converting all my "action" subflows into flows and changing all the "calls" to LinkCalls would be way more work than just adding a global flag to tell the DelayedShutdown subflow to not actually do anything when its delay is finished.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.