Retrieve & Decision activities

I have the following practice app: A page with products (“Product_Overview”). If I want to buy some products, I have to select them and press a button called “Add to cart”. After this action, the selected products will be added to another page called “Cart_Overview”. For that button (“Add to cart”), I created a microflow: In this point, everytime I add to cart some products, a new cart is created and I want to change that (because it’s not ok to create a new cart everytime I press the button “Add to cart”). I want to make a check, for checking in the database if the cart already exists. If the cart already exists, I just want to add the products to that cart. If not, I want to create a new cart (this part is already implemented in the microflow above). Could you help me? I know that I should use a Retrieve activity to bring all the carts from the database, then a Decision activity to check if the cart already exists, but it needs something more. Any ideas? I will also attach below screenshots with the Domain Model (1), the “Product_Overview” page where can be seen the “Add to cart” button, too (2) and the “Cart_Overview” page (3). Thank you!
1 answers

Heey Valentin,


Your thinking in the right direction. What i would do is create a GetOrCreate flow for Cart and in there check if the Customer already has a cart or not.
It would look something like in this screenshot.


Hope this helps.


Kind regards,