Trigger a custom event when data changes - "field to watch" is missing

Hi everyone. I’m trying to create a group chat function, with a repeating group that lists all the messages. I want the repeating group to scroll to the bottom (i.e. most recent message) whenever a new message is sent. For example, if User1 is looking at the chat, and User2 sends a message, I want User1’s screen to scroll down and reveal the message.

To achieve this I figured I would use the “trigger a custom event when data changes” function. Each chat has a “most recent message” field so whenever that changes in the database, the repeating group would scroll to the most recent message for any user with the chat open.

But I have run into trouble with the “trigger a custom event when data changes” function. In all the videos I’ve seen, there is a “field to watch” option (in my case I would watch the “most recent message” field and trigger an action when this changes). But for some reason mine doesn’t seem to have the “field to watch” option - see screenshot.

image

Am I missing something? Or is my overall strategy wrong. Thanks so much for your advice!

1 Like

Have you set a parameter of a custom datatype on the custom event?

1 Like

No…there is a field for parameter but I don’t quite understand what goes in there.

Well if you don’t set a parameter there you won’t be able to define which field to watch.

So you need to set a parameter of the relevant thing in the custom event first.

Hmm OK thank you, I think I need to go research parameters a bit more.

I have added in a parameter now to my custom event.

image

I still don’t have a “field to watch”?

Sorry, I don’t have a clear grasp on what the parameter is actually doing. Can anyone clarify?

I still don’t have a “field to watch”?

That’s not the same Custom Event…

Sorry, I don’t have a clear grasp on what the parameter is actually doing. Can anyone clarify?

Custom - Bubble Docs

Sorry Adam I’m not following your answers here I’m afraid. Are you able to explain in a bit more detail? I don’t feel like I’m any closer to a solution! In the video I watched there is an option called “field to watch” - see this screenshot from youtube.

image

But mind doesn’t have this option. When I added a parameter in I still don’t get the option…

You didn’t add the parameter to the custom event (you added it to a different custom event).

The parameter needs to be on the custom event you’re triggering when data changes (that data being the type defined in the parameter).

Hmm. Ok I’ve changed it. I have one custom event called “Data changes” with a parameter called ‘Most recent message’ and type ‘Thread’. (The field I want to watch is of type Thread).

image

Now I select the action “trigger a custom event when data changes” and I get this:

No option to watch a field, and there is no custom event to select in the dropdown.

Where am I going wrong!

You first have to select which custom event to trigger…

Then you’ll have the option to define a thing to and a field to watch (as long as the custom event you’re triggering has a custom datatype parameter declared).

Haha, OK I think I’ll have to go look at custom events again from first principles, cause I’m just not following. If you know any good resources for an overview of custom events let me know - I haven’t really been able to find much.

Thanks anyway for your time :grinning:

Probably Bubble is preventing a workflow step triggering the same custom event that triggered the current workflow … i.e. cannot trigger itself.

Try putting the step “trigger when data changes” into a different workflow, for example in a Page is Loaded workflow.

FYI a couple of years ago I found the performance / stability of this feature didn’t match my expectations for updating a chat, hopefully it has improved

It worked!! Thanks Mishav! That has been blocking me for so long, such a relief :relieved:

Thanks Adam as well! :grin: