Bubble not making changes to user field, despite debugger showing that it does

When a user gets referred to my app by an affiliate, I store the referral code in a cookie. I have a workflow that gets the cookie’s value on page load, and then it’s supposed to “Make changes to current user” and save the cookie value in a user field called “Referral code”.

When I run the debugger, everything appears to be working. You can see that it detects the cookie value:

Yet when I check the database, that field is empty. I refreshed bubble several times and it’s still empty.

The weird thing is that the Session ID field does get updated every time I load the page (with an arbitrary number), but the Referral code field is always empty. Could this be a bug?

Are you logged in?

I’m logged in

It’s probably a timing issue (I’ve had these a lot when using cookies)

i.e. the cookie value has not yet been read when you’re trying to store it in the database.

The easiest way to ensure it has, is to move the Make Changes to a thing action out of the page load workflow, and instead use a JavaScript to bubble trigger event, to only update the database when the Cookie Value has successfully been read and output to the JavaScript to Bubble element.

1 Like

Using a ‘when condition is true’ workflow did the job, thanks!

EDIT: Just switched to using the Javascript to bubble trigger event as you suggested, it worked. :slight_smile:


This topic was automatically closed after 70 days. New replies are no longer allowed.