Run a workflow within every cell of a Repeating Group

Scenario
Say you have a repeating group filled with different fields, for example a list of employees and their first/last name. You don’t want to autobind the name fields, but you don’t want a save button in every cell either. How can you set up a save button to make changes to all the cells of a repeating group, using elements (in this case input fields) within that group?

It’s a workflow that’s surprisingly difficult to set up in Bubble. Sure, you can run an API workflow on a list of things, but it will disregard the info saved in the elements of each of the cells.

What’s needed
For the solution I came up with, I’ve used two of @gaurav’s plugins: Env Environmental Variables (bdk) and Utilities (bdk). You’ll probably be able to do this without the first one though.

How to do it
First, place an Environmental Variable element outside of the Repeating Group. This will serve as the trigger for the workflow you want to run in each cell. Set it up with a Yes/No type with the default set to No.
image

Then, set up a button that changes the value of the Environmental Variable you just created:
variable

Inside each of the cells of the RG, you place an If-Then Workflow element.

image
What this does is trigger a specified workflow if certain conditions are made. Wait, you say: you can already do this with Do When Condition is True, and you’d be right - except, you cannot trigger a cell-specific action (an action that relies on elements within a cell) with a Do When […] workflow. But with the If-then Element, Bubble recognizes it as a part of the cell of the RG, and you can fetch info and manipulate elements within that cell.

In the If-Then WF element, set it up to react to the value of the Environmental Variable:
image
Make sure that Run automatically on change is checked.

Then, in the Workflow editor, set you the workflow to trigger when the IF condition is true:
variable
If you choose Make changes to thing, you’ll see that you can reference the cell Data Type and elements within the cell where the If-Then WF element is located, allowing you to run a cell-specific workflow from outside of the RG.

Word of caution
Before you go overboard with this, remember that you are basically triggering potentially a shitload of workflows all at once, depending on the length of the RG. If you’re working with long lists, you can make your own app very sluggish or even timeout the operation if you demand too much of Bubble at once. Even if your list is not long now, consider the fact that it may be in the future.

Word of caution 2
Remember that you are not technically running a workflow on a list here: rather, you are triggering one single workflow inside each of the RG’s cells. If a cell is not visible (if you’re using pagination for example), it will not trigger. So as with all tools, it has it’s specific uses.

Hope this can be useful to someone, and as always, if you have a way this could be made even simpler, without plugins or if you happen to think my solution is an inefficient mess, let me know!

18 Likes

Hi Petter

I just bought both plugin’s for this, but I’m not able to reproduce you work around.

I have a Thing “BKT” that is sorted in a RG on the field “Bijzonderheid”
All rows in the RG should result in a ZAPIER web hook PER row.

So your solution should be the ultimate solution…

I have:

  • add the plugins
  • Added the EnvVariable Trigger outside the RG en set as the picture.
  • Connected a button to the workflow that change the value to YES
  • Added the If-then WF into each cell of the RG and set it as the picture.

The is See exactly the same video as the button setup…???
I can’t see how to proceed…

Your help is much appreciated!

Marco

Hi @marco1,

Can you tell me a bit more about what’s going wrong? Does it work on no cells, or just one?

I can have a look at your app if you don’t mind sharing it.

I just noticed that the last gif is actually the same as the previous one, which is understandably confusing. I didn’t notice until now.

What you need to do for the final step is to add the IfThen Workflow:

I hope that solves it, sorry about the mixup.

hi petter

I do not have the “Element” in the Workflows menu…

In the page workflow I also can’t find it. I only can find this:

If I select the “Run if-then Value” I need to fill in the element, and no element is found.

Thanks a lot for your advice!
Marco

1 Like

In your image, you’re currently on the API Workflow page. You can’t reference a page element from an API workflow, so you’ll have to place it on the page where it’s located. If what you want to do needs to be placed in in API workflow, you can trigger that workflow from the page and pass whatever parameters you need by scheduling the workflow at Current Date/Time.

Clear, but the last screenshot is from the page…

Here is what I see in het page workflow…
Screenvideo

Yes, but in the last screenshot and video you are trying to insert an action, but what you need is an event. Remember, the IF-then wf is triggering an action. So you’ll need to look for in the Click here to add an event button in the page workflow editor :slight_smile:

I’ll just mention that this trick can be done easily with just the Utilities bdk. Just set the “if” to something simple like “Current User is logged in” if you want the action to run automatically.

Thanks for sharing this! :slight_smile:

1 Like

Of course, today, to run some workflow on every element of a list, we just use List Shifter. See: Live Bubbling with @keith: Let's Iterate Over Some Shtuff

3 Likes

Thank you!

2 Likes