I’m having an issue with an API workflow for a checkout process in my e-commerce project. I have DT_CartItem, DT_CheckoutItem, and DT_CheckoutSession data types. When a user goes to checkout, an API workflow (CreateCheckoutItems) is triggered with an initial index value of 1 to create DT_CheckoutItems from DT_CartItems.
The CreateCheckoutItems workflow:
- Creates a DT_CheckoutItem from the DT_CartItem at a position specified by an index parameter.
- Adds the DT_CheckoutItem to the DT_CheckoutSession.
- Schedules itself to run again with index increase by 1.
This repeats until the count of DT_CheckoutItems equals the count of DT_CartItems. However, when there are 3 DT_CartItems, 3 DT_CheckoutItems are created but first one is empty, it doesnt have product in it but has quantity nad price of the second one in the list . Without the index parameter, it correctly creates 3 DT_CheckoutItems.
Here are screenshots of the relevant parts:
Any help would be appreciated. Thanks!