Display only listings a user has responded to

I have a marketplace of listings that allows other users to message the user who created the listing. For example, if you list a product, another user can message you about that product.

I’m also creating an inbox/dashboard where users can see all the messages they’ve sent and received. But I don’t know how to restrict the search to only those messages. If I just run a normal search for listings, it will display all of the listings in the marketplace, won’t it?

Any advice about how to structure my database and design to do this?

Couple of ideas, one is to keep everything connected to the messages data type.

So on your messages data type, have (as you would need) the fields for users involved in the conversation, which for me, usually is two fields, one for ‘recipient’ and one for ‘sender’. Both are of type User.

Then have a field on the message data type of ‘product’ related to the product the message is about…which always comes in handy for other features such as quick link to product the message is about etc.

Then to show the User the list of all products they sent messages about, you can simply setup a repeating group with data type of products then in the datasource do a search for messages and constrain by the ‘sender’ to be equal to current user, and product field is not empty. Then the last part of the expression after the search for messages is ‘each items product’.

1 Like

Thanks so much @boston85719. Really appreciate it.

How would you do this if you wanted to display messages that the user sent OR received?

Let’s say the user was interested in another product and sent a message about it - I would want that to be displayed. But if someone were messaging them for the first time, I would want that to be displayed, too. How would you accomplish this with the constraint approach?

One more question, if you don’t mind. I want to group conversations into three buckets for users:

Think of it like three separate inboxes. I thought about using the tab element and then putting RGs within each tab. Do you think that’s the best approach or is there another better one?

Thank you so much for your help.

Use a datafield that is a list of users that I call ‘participants’ and use the search for messages with constraint equals participants contains current user.

Sounds like you are asking about how to show messages and not products.

Just do a search for messages with constraints participants contains current user

I’m not sure of your database structure etc. so can’t say, but I’d likely use a option set for the type of message and depending on where the user can send a message from I would apply the option set value to the message data type as a field.

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