Event listener and object in context


Is it possible to use an Event Listener enabled Container to update an Object in Context?

The case is I want to track if a chat message is read or not. I have the Listener inside the iterating container and it runs an action with select object in context, but object in context is not found.
I have tried some shenanigans trying to give the action the id of the message in context, but that is not found either.

I considered using an element ID an a coded component but i dont have the knowledge yet about where to start and if it is even possible.

I have used an action that is triggered when the chat is opened and updates all messages to read, which should work fine in most cases.

But I am still curios about the use case of event listener and object in context.
Does someone have some experience with this? :slight_smile:

Hi @Sondre ,

I tested it quickly on my end, and it worked. I added the listener to the single message container, and it also worked when using the update object in the context action on the ‘on viewport enter’ event. Could you please provide additional details or screenshots of your setup?

1 Like

Hi @Simona ,

there is one main difference that is the source after a bit more testing. I tried using a select to select object in context and then update the relational object between the user and the message to read.
But select is maybe a bit weird with multiple objects in the same class in context at once? It seemed to not work even with one message, but i might be misremembering.

Either way i figured out in the case of a action param ID input. That it receives the correct input, but i had forgotten to remove the action from a parent container (made me think that it ran with an error, but the correct place never got triggered because of parent). So I update the relational object based on the message ID input. And that works.

Thanks for the suggestion, helped me iron out the other problems :slight_smile: