How to Loop Through a List and Modify Things Without Backend Workflows or Circular Workflow Error (Free Plan)

Hi Bubblers,

I need help implementing a working loop for processing a list of items on the Bubble Free Plan (which doesn’t support backend workflows). Here’s what I’m trying to do:

:light_bulb: Use Case:

I’m building a simple POS system for hardware stores. After a user adds items to a cart and hits “Process Transaction,” I want to:

  1. Loop through each item in the cart.
  2. Reduce the stock quantity for the selected variant of each cart item.
  3. Record the sale.

:brick: Database structure

  • Cart Item→ has a field variant (linked to Variant), and a quantity
    -Variant→ has a stock quantity field
  • Sale → will store the details after stock is reduced

:downcast_face_with_sweat: The Problem:

Since I’m on the Free Plan, I can’t use backend workflows. So I tried using a custom workflow to loop through the list, but:

  • Bubble throws this error:

    “Circular custom workflow – custom workflows cannot call themselves (either directly or indirectly)”

  • Even though I created a separate “loop” event and a “process single item” event, Bubble still complains because one ends up calling the other.

:test_tube: What I’ve Tried:

  • Creating a LoopIndex state and a list state on the page.
  • Using Trigger custom event inside a loop.
  • Keeping the loop logic on the page level (frontend).
  • Splitting into two workflows (e.g., one for looping, one for processing) — still doesn’t work because of the circular workflow rule.

:package: What I Need:

I just want a working loop structure on the frontend (Bubble Free Plan) that can:

  • Go through each Cart Item in a list
  • Deduct the quantity from the associated Variant
  • Do this reliably without hitting the circular workflow issue

:folded_hands: Help?

Can anyone share:

  • A working example (even in a test Bubble app)
  • A trick/workaround to loop through lists using only frontend logic (no backend workflows, no plugins)
  • Any help to break this blocker — it’s the last step in my workflow

Thanks in advance for the help. :raising_hands:

I’m working on this to support small businesses here locally, so any guidance is really appreciated.

I suggest use the free credit to upgrade, build feature properly, then downgrade and continue your build. Don’t waste time building a workaround that once you deploy to live and start paying a bubble subscription fee, is a feature you’ll want to rebuild the correct way.

2 Likes

Thanks

Instead of using ‘Trigger a custom event’ use ‘Schedule a custom event’.

This will allow to circumvent Bubble’s (ridiculous) limitation on loops.

Alternatively, you can use (for example) a forEach loop in a run JavaScript action to call a JavaScriptToBubble element with an associated WorkFlow for each item in your list.

But don’t try doing this on large lists.

1 Like

Thanks

@hardyfawei4real why don’t you use this plugin: Simple Looper

you can have two custom events. The first is the Action Event which will loop. Give it two parameters - counter and max - both numbers. Then make a second which is the a looper. Call the Looper from the end of the Action Event if the conditions (counter < max) is not met, and call Looper with the parameters Counter + 1 and Max. Looper only calls Action Event and passes Counter + Max to it (to keep track). This can get slow, as it’s all front end, but it will run Action Event, then if not complete, call Looper, which just calls Action Loop again.

does it suck? Sure. but it works, use sparingly.