How to use more than simple flow and randomize?

Hi there! I wonder if it’s possible to continue a flow with two or more paths and use the second one if the first fails, or completes.

Sorry if that question is replied before, I searched but probably without the good words :grimacing:

I mean something similar to that:

1 → A/B/C (different paths)

  • If [1 → A] is completed, next time the flow will be [1 → B]
  • If the first attemp fails, the [1 → B] should be inmediate (or C if B fails too).
  • Every step should to be used only one time on completes, for mix the steps and results.

(I’m trying to mix OpenAI image generation with Unsplash API and random hosted ones)

Hey @matenauta, an n8n execution does not know what happened in a past execution. So if you want to make sure that your path B is being used in the next execution after path A has executed, you need to store this information after executing path A.

You could use pretty much any external storage for this, just make sure to update this information after each path you execute and read it at the beginning of your workflow.

You can also use n8n’s static workflow data for this, but this is a bit tricky as it won’t work for manual executions.

1 Like

Hi there, thanks for the following up!

I’ll check this out because I’m using N8N for replace Zapier/Make and I’ll try to build almost everything automatically and not manual.

Of course, now I’m testing with manual triggers but definitely I’ll need to move and it seems to be cool to get deep into that :slight_smile:

I’ll try to jump the tricks by myself but I’ll ask for direction if I get stucked.

I will share all my workflows (Discourse, OpenAI, Budibase, Mailgun and Kelia (a few manual webhooks and http requets) when they will be ready for production :raised_hands:

1 Like

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