How to pass number saved in element state to Scheduled API Workflow for Creating list of things

Hi everyone,

I’m currently working on building a checkout process, and I’m running into an issue with managing the quantity of products in my repeating group. Here’s what I have so far:

  1. I have a repeating group that displays the products.
  2. Each product is selectable, and if it is, I save it to another repeating group.
  3. I’m also storing the quantity of the selected product into a element state in the current cell.

When clicking on the yellow button below, I’m using a scheduled API Workflow on a list to create new order_items. I’m using a loop to repeat the process and create the right amount of order_items based on the quantity.

However, the problem I’m facing is that I can’t send the correct quantity (iteration) to the scheduled API Workflow, since the value is stored in the element state of the RG. I’m not sure how to fix this issue.

Any guidance or suggestions on how to correctly pass the quantity to the scheduled API Workflow would be greatly appreciated. Thanks in advance for your help!

Hmm :thinking:

I could think of a few different ways to solve this.

Have you tried creating a thing in the database ‘checkout item’ and then just saving the values onto that? If the user leaves and comes back, it can still be in their cart that way too.

Does that help at all? :man_shrugging:

Thanks @j80231502 for the comment! That would definitely work. I like the beauty of handling it all on client side up to the point of clicking the button, in terms of speed and keeping the DB clean. (in case I understood you right)

Yeah, if you want to do it that way, there might be a way to use a plugin to access that information like this one: [New Plugin] bdk RepeatingGroup tools

Or doing some complicated list of numbers that match up with the list of items in the repeating group. You would need to be careful to make sure you adjust or delete the numbers that match with the record.

Or there might be another option… :man_shrugging:

I’ll have a look at the plugin, thanks! If somehow possible without a plugin would be amazing. Maybe someone knows a workaround

1 Like

@home

Ok, here is a really weird way to grab the numbers from your cart within an input inside of a repeating group.

Editor: testApp42wCleanDB | Bubble Editor

Preview: https://testapp42wcleandb.bubbleapps.io/version-test/rg_cart_checkout_states?debug_mode=true

Does that help at all? It’s not using any plugins. This is not how I would do it, but I think it matches what you are trying to do. So there is nothing being saved in the database and then you can pass along the list of numbers to the backend. :blush: :man_shrugging:

1 Like

Hey man, haha wow, that’s a crazy workaround! :star_struck: I really appreciate your effort! Thank you so much! I will try to implement it in my project today. I’ll let you know if I’m successful!

1 Like

Sounds good. :blush::raised_hands: