Help with triggering multiple entity creation

I have a “Budget Template” entity. I’m trying to create functionality where I can click a button, specify a start date and number of entities to create, and go. It works great, except Fibery shuts it down because it thinks it’s looping (which it sort-of is, but I’m not sure how else to do it).

Important fields on Budget Template:

  • Period (monthly, yearly)
  • Number of Budgets to Create (rests at 0)
  • Start Date (represents the start date to give to the next created budget)

The flow goes like this:

  1. User presses “Generate Budgets”
  2. Popup asks user for number of budgets to generate and date to start generating budgets from.
  3. Automation detects a change in “number of budgets to generate”. Automation continues only if “number of budgets to create” is above 0.
  4. Automation creates new Budget linked to parent Template using the Template start date.
  5. Automation updates Template start date to be “end of created Budget period + 1”
  6. Automation decrements “number of budgets to generate” by 1, triggering the automation again.
  7. Ideally, this process continues until “number to create” has reached 0.

Since I’ve built this right, it shouldn’t create an infinite loop, but Fibery still shuts it off as such after 2 runs. I assume it’s just because it can’t tell that my filters would eventually halt the looping, which is fair.

So, what’s the recommended way to accomplish something like this? I guess I could do it in increments of 2, or completely manually.

In terms of volume, I have under 100 budget templates that should create, at most, 12 budgets (1 for each month), and I would only need to use it once per year.

1 Like

Automations requiring loops or recursion can only be done in Javascript, for this reason of “loop detection”.