Forum Academy Marketplace Showcase Pricing Features

Thing not getting created in DB even though Unique ID gets generated

Might not be necessary fo the explanations. I have a couple of ideas as to what might be the cause. If I get stuck in my problem solving I’ll let you know.

Okay. Here you go:

Error is in first workflow.

Right now I have added step 2 and step 3 to debug the issue and send me email when DB search fails on not finding element in the DB. That is causing another issue of debugger breaking. I have reported that as a bug. And I might remove these steps until Bubble tells me what is going wrong there.

Screenshots that I had posted were for the workflow “Restore Need” which is called in step 8 of first workflow.

First question:
Why have you broken the create and make changes steps into 2? Why not just set all the fields in the create step?

So I had it in one step earlier. This is all for the debugging I do.

Two reasons for breaking into two:

  1. It helps me see in the next step in debugger that entity was actually created
  2. I was copying some values from the entity that is being passed to the workflow. Now due to this DB thing not getting updated, sometimes the entity passed to the workflow was this non existent entity, and non existent thing’s values were being copied. I suspected that that might be causing some issues and then broke into two. It took me some time to break into two actually.

So the new need is automatically created when the page is loaded?

No. It is created only if there was a temp need id stored in the cookie. If there is a temp need id in the cookie then I create a new need and copy the value from the need of which ID was stored in the cookie.

I have done this to be able to preserve form filled by user before logging in as when they submit the form i force them to login.

Also, if the temp need in the cookie is created by same as user as current user, then I assume to the be the case of a logged in user going back to the first step and trying to edit it. In that case “edit need” is set “yes”, and then also new need is not created.

I haven’t worked with cookies before, but I have similar process flow and don’t need / use cookies. I just use a combination of the form values and custom states. Not sure all that complexity is necessary. What will you do if user says they don’t want to enable cookies?

If cookies are disabled, they have to just fill the form again. But mostly people agree to it, so it is okay.

How do you achieve the same workflow without cookie?

All the form inputs are still available yes?

I am doing it as per the recommendation in this thread: How to attach anonymous data to existing user after they log in?

Form fields are available, but when user logs in after filling the form before being logged in, then to get that data you have to have some linkage between non logged in and logged in user.

But isn’t it the issue of a thing getting created but not reflecting in DB? Cookies are storing their values fine.

fair call. I’ll get back on trying to figure out why the thing isn’t being created as expected. But I’ll just say this… Whenever I have over complicated how I work with data, it creates downstream problems.

For example, I wonder if the issue is being caused by privacy rule conflicts with the logged in user and referencing that data stored in the cookie. Tough to diagnose this, but that may be something for you to explore.

I had gone that route.

Two things there:

  1. I see no other way of specifying what I want in privacy rules. I did what all I could do to my common sense.
  2. I have seen this behaviour of data not storing even if I remain logged in and fill the form and come back to this page after going to step 2. So, both the temp need and new need are created by me only. No issue of non logged in and logged in user. However, even there the thing that I created doesn’t register in DB.

Nobody wants to complicate things. We all do as per the constraints. Here constraint is Bubble works in a certain way only to implement certain things. And other constraint which I have put on myself is that I don’t want to force users to login before filling the form.

Btw, cookie is just storing the ID of a thing that was created earlier. Cookie is not storing the thing itself.

ok, I know you told me to quit with the cookie thing. But I just created a few customer needs without any problem but without being logged in. This is just my suggestion, but I would change the workflow as follows:

  1. User fills out form.
  2. User clicks “post need”. At this stage, no entry is made to the database. the only thing that happens is the log in pop-up is shown.
  3. User completes log in / sign up steps and clicks sign up.
  4. At this stage, sign the user up and then create their first need as the next step. No cookies needed :slight_smile:

And what if user drops off because of friction of logging in / signing up? I don’t want to lose them. I want to call them and see if we can do something for them.

Also that won’t work in case of social logins, as in case of social logins, page refreshes after logging in.