How to forEach in a list of text in Bubble Action Plugin Editor

In the plugin editor, I have this field:

I use the plugin like so:

In action inside the plugin creator, I have this code:

but I constantly receive an error saying product_ids.forEach is not a function. When I try to console.log(product_ids), it looks like this:

Image 2-17-23 at 12.27 PM

which looks correct, they are all the values I want. But it’s not doing the loop I need. What am I doing wrong?

If product_ids is a list field in your plugin then it’s not an array. It’s a bubble-specific object with methods for getting the actual array of values.
If you read the documentation above the plugin’s function (it’s updated dinamically) you can see how it works.

@dorilama, is there a way to transform this Bubble List to a javascript array? I’m more familiar with operations in js more than bubble.

The bubble list it’s still javascript. As I said it’s explained in the documentation inside the plugin editor how to get an array of values. If you don’t see it then it’s not a list field that you have.

1 Like

Yeah, I got it. there’s a function to return an array when applied to the current list. then I use forEach to the return and it treats it like normal javascript.

Just to clarify: the list you get from the properties object IS normal javascript, it’s an object. The only thing is that it’s not an array. Nothing magic or non-javascript happening here.

1 Like