Create multiple records from a custom state list

Hi,

I am a newbie in Bubble and trying to evaluate the development platform.

Currently on my front-end screen, I give users the ability to select an item and enter in a quantity, On save it adds it to custom state list in a JSON format:

{“itemId”:“1647895321417x713130204034445800”,“Quantity”:10}, {“itemId”:“1647895523767x990849363876969100”,“Quantity”:1}

Once they click the “Create sale order” button to create child records by iterating through the custom state list.

I am stuck on how via Workflow actions where it can do the following:
(1) Loop through my custom state list
(2) Extract the item id and quantity from the JSON individual item
(3) Create a record per entry

Is it possible to do via the “Schedule API workflow on a list” or “Copy a list of things”

I checked both options and seem to be stuck. Appreciate any help on this.

Regards
James

Hey Keith,

The link you shared was great and exactly what I needed. Looked at that video and it helped me with that I needed to do next for my setup. Thank you!!!

@jdcunha If I may ask how did you create the JSON structure to be added to the custom state? did you use plugin? I am trying to do the same. Thanks for your insights.

I used the JSON Generator plugin to create the JSON structure and then use that data to add it to a custom state list.

Thanks, so the data is first stored as things in the database, en from there you generated the JSON?

Yes, I had an items table in the database. On my form I had a workflow defined to the a button “Add Item to Sale Order” where it would do the following:

  • save selected item id and quantity value to the “JSON generator” element that is placed on the form
  • Then use that JSON data and add it to the custom state list