I’m trying to skip a “Create Form” action by adding a button that creates a row in my target database. The problem is after adding that row, I want to automatically navigate to a Detail Page of that row, and I can’t seem to do it.
For context, I’m creating an order and want to navigate to order details straight afterward.
Does anyone know if this is even possibe?
In using a create / add item form, it’s easy as you can set on submit action to show details screen.
Without that, you can still do it. You just need to know which details screen to navigate to. The newly created order has a row id, but I don’t think there’s a way to know it at the point of your action creating it. You could view the last… but that to me seems sketchy in the case of multiple users doing actions at the same time. Are users logged in? If so, I’d probably have user id written to the order row, and have the action after adding the row, navigate to the last viewed order created by that user.
*Edit… I tested this out and found something to be mindful of. If you write user ID to the new order row, and have a rel to all orders with your user ID, and then have a single value of last order from your orders, there’s a time issue. The action tries to go to the details screen before the row is created… which means the first order a user makes, it doesn’t take you to details. And second time, it takes you to the previously created order. You can fix this by adding some sort of condition. First one, a wait for single value of last order created to exist. For future ones, a sloppy wait a second or two would work but that’s sloppy. So… I would try to use something known from the order created. An order number or time stamp that you can write to the order, and also lookup in a relation.
Would always have to add a wait of 1-2 seconds just in case, or use a unique ID like you proposed and wait for the “relation” to not be empty.
For context: orders are fashion products and you are shown where to buy the product after making the order.
The problem is there is no user_id or email anywhere on the order.
You basically create the order without having to log in or anything. Then, once you have the order created and you see the initial value you could get, you are prompted to sign in in order to confirm the order and access the link.
I’m a little confused here… Is the user actually creating an order then? If clicking buy osimply takes you to a screen that shows where to buy it, that sounds like you just want to take the user to the details screen for the product, not the details screen for a new row on an orders sheet. What is the purpose of the orders data sheet and the row you’re talking about adding?
Not being logged in isn’t an issue either way. Using user id and going to the last order created by that user, I don’t think is best anyway because it requires putting in some “hopefully long enough” time delay. Better to use an ID you know is unique to that order. Write a unique id in a temp spot, and then write that to the new order row you’re adding. But from your context, I’m not understanding why this new row or the need to go to the details screen for this row, is needed. It doesn’t sound like there is any real order being placed… just showing a details screen for the product… ?
I’ve temporarily used a short delay like that to wait for something, but I’ve always later found another more certain method such as waiting for a unique ID, to replace it with. While having the short delay in place it’s always worked for me but since I don’t have a good understanding of how long it could take, it makes me uneasy! I guess there isn’t too much concern though, since that is happening on the device… it can never take more than a moment?
The reason the order is being created is because the flow is as follows:
- You access the product detail page with information about the product. You have two options: buy online, or view in store.
- If you choose to pick it up in store, an order is created with the product info and unique id. The information regarding user name, email, notification method, pick up dates, sizes, purchase ticket, etc. is left empty.
- The user navigates to the order detail page and sees their order with two buttons: choose pick up date (not necessary as they can go to the store without a reservation) and upload ticket. On this detail page is also the information regarding the order status (Reserved, Ready for pickup, etc.) and where they can find the product (map). The user data gets populated once they actually make a reservation.
Here’s a solution… the one we were talking about before with creating an order ID, saving it somewhere, and then going to the details screen for the order with that ID.
It would be nice to just user user ID, but since they aren’t always logged in, I think this is how it has to be. It just costs and extra update because the unique ID has to be written somewhere first, and then written to the new order row.
You need a somewhere to write the unique ID. Since user may not be logged in, I chose to use the Product(Things) sheet, and make sure it’s user specific.
You need to create a column in the Orders sheet for this order ID (not a sheet generated row ID)… just a basic text column.
Relate the order to the Product(Thing).
Your action will cost two updates. First set a unique ID to the user specific column we just made in your product sheet.
Then create your order by adding a row, and write the unique ID from the last step into the new order.
Last you can show details screen for the relation created in the second screen shot.
That should do it. My test didn’t run into any timing issues, but you could add wait conditions if you find there’s reason for concern there.
Yeah, if it takes more I would say that’s an error.
Your solution above would work, but I think OP should add a hint to say if you log out mid-way then your orders are not saved (because user-specific columns get reset).
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.