When a user clicks the ‘contact’ button, a message form appears. They can write and send a message to the business, which is served inside my platform.
After they write a message, I want the user cards that they contacted to have a ‘Last contacted on X date’ message. Obviously this will only be visible for the user who contaced that business, not visible globally to all site users.
Not sure how I can do this. Any guidance is appreciated
You can create a database for that “contact message”.
Example: Create a database “MessageCards” add some fields like: “Message” (type text), “ID” (type text) and “Date” (type date)
((PS: You can also use Created date, but for me its more confortable to play with dates creating a specific field for that)).
Write static text “Last contact:” Then we start dynamic data -> Do a search for MessageCards’Date :lastitem Important to use last item, because we want only to show the last date.
Then on the search for messageCards add 2 constraints.
1- Created by = Current user (For only show the actual user last message)
2- ID = For filter the message and search the last time of that current cell.
Messages and Conversation serve up the messaging system. Instead of creating a new data type,should I add those fiels to the existing message data type (I already have the ‘Message’ field which is called ‘content’, unless they are serving different purposes on this instance?).
@yusaney1 One more thing if you’re able to help! I have 2 custom states for my repeating group:
• View all (show all results in repeating group)
• Contacted (only show ‘contacted’ users in repeating group).
When I click View All / Contacted, the custom state of the repeating group changes to the button clicked. It works well, but in my ‘Contacted’ button, I’m trying to show the number of contacted users. For example: Contacted (5).
The issue I’m running into is that at the moment, my contacted:count is actually a count of total messages sent, not just number of people contacted, so if I sent 1 person 2 messages, I see ‘Contacted (2)’.
Here’s the data I’m trying to use (I probably need to use Users instead of messages, so that I’m only counting individual user IDs)
When I try do ‘do a search for users’, I’m not really sure what constraint I can use. I guess I need a new field in users that refers to messages created?
So i recommend you do this:
1- If your Messages db has not field type Users, create one, example “Sent_to” user type or your “conversation” field, i dont know what type of field is it, but if targets to target user, you can use it.
1.1- When you send a message to a user remember to fill that cell with the “target user” (The user will recieve the message)
Then in the Search for messages “sent_to” use :unique elements :count