How to Fully Reset Workflow Context and Remove All Previous Items Mid-Execution?

Hi everyone,

What I have so far:

  • I have a workflow where if an IF node is false, it must re-run the workflow from scratch.

  • However, data from the previous execution is carried over and is still used once if node is passed again in the second execution.

My Question:

Is there a node or a way to reset the workflow (like it was never executed)?

Hi!
Try to use switch nodes!

Anyway, can you give me the example of n8n flow?

1 Like

Hi @cutecatcode, thank you for your suggestion. However, I don’t think it solves my problem. It could be that I didn’t implement the switch node properly. I cannot provide the actual workflow, but I can add a sample workflow, similar to what I have been working on.

So here, if image branch is passed then declined, it will still retain the data. With that, it seems to not generate a new image on the second execute. Also, ‘Is post image?’ node will also be always true since i used ${'Is post image?'}.isExecuted.

Basically, what I’m looking for is a node or a way to re-execute node once Approved? node is false.

So, after declined, it should be restarted at ‘Pick a Task’, right? And to remove the item, you can use set in the middle node between Pick a task and Post Approved node, so when you try again, the data that already brings by Discord will be erased with the set node