Linking Database of customer and order database

Hi,

I am using my User database as the customer database. I created a new field in User which is Orders, which takes a list of orders.

Flow:
So when customer creates an oder, the order is then added to the order database. The oder will also contain the user’s email. I then want the unique ID of the newly created order to be added to the current customers Order’s list.

Question:
How do i retrieve the order’s uniquie ID. What I tried is make a change to current user-> do a search for ->order = abritrary text (current user’s email) → return first item

Is the only way to search is do a search? Is this the current method? Once it does a search and return, how do i access its unique id?

If you create the order in step1 for example, then in your make changes to the current user action, all you need is to update the orders field and add: result of step1. You don’t need to worry about the unique id. Bubble will handle it.

It is not needed but If you really want the unique ID of the recently created order, you can do the same result of step1 (assuming you create the order in the first action in the workflow.

@hergin , thank you for your reply.
My workflow is clicking button → create a new order (where i create a new order and fill the property fields of this) → make changes to current user → orders → add. How do I add the result of the previous step to it? I do not see this option available in drop down. How do i get the result?

It is not another action. Inside the make changes to current user action, you will get the order: add: result of step1.

For example, I create a group in step1, then I set it as the current user’s group in step2.

@hergin , ah thanks I see, I am able to add Result of Step 1. I then checked the database and it adds the unique ID to the list of Orders. Just curious is this what is suppsosed to be added when we have a type “list” for database? Not the entire Order object added to the database?

This is true for any field or list of things. You relate with the actual thing but bubble saves them by id anyways.

2 Likes

@hergin thank you. For my orders page where I want to display the orders or a specific order. Would I use the Do a search for?