How to sort the chatroom by last message sent date?

So I have a list of chatrooms and I was wondering how to sort it by the date the last message was sent, the newest at the top and the oldest at the bottom? and also I want to display the latest message sent in the chatroom as a subtitle, is this possible?

Thanks very much

Hello, in order to do that, in my opinion the easiest way to do that is by having an extra property for the Chatroom collection in the DB, called “Last Message” and every time the user send a message, that property is updated. So in the case just display it in the subtitle and make the sorting “Updated newest to oldest”

Hi i have added the last message in chatroom db and relationship to the messages but however I can only change the last message into this, how would I approach this? Thanks very much

No need for a relation. Just add a text type property and add an action whenever the user send a message to update current chatroom > last messsage taken from the input

You can create a Date and Time property on the Conversation collection and name it as like Last message sent date and add a Update current conversation action and fill that field with current time and sort the list as Last message send date - Newest to Oldest.

Thank you

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.