Repeating group - show 'last contacted on' message on profiles

Hey,

I have a repeating group which is loading a bunch of user cards with account type = ‘business’. These businesses are contactable.

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)).

https://puu.sh/zA4fo/a8503aabde.png

Now go to Contact button workflow and add Create a new thing workflow (after the send message) and configure it like this:

https://puu.sh/zA4uP/2e5e69c1bf.png

(ID = Current Cell unique ID, that’s useful for make sure its showing the time of the specific cell)

Then you can create a Text in the repeating group, and Do search for (MessageCards) and configure it like this:

https://puu.sh/zA4xR/c7af2376d5.png

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.

And you will get something like this:

https://puu.sh/zA4En/cad81957aa.png

1 Like

Wow, thanks for the fantastic response - I’ll be trying all of that out today!

I already have the following Data Types:

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?).

Best
Piet

Yeah sure, i used in this case ID field because i had no repeating group, just created a very quick scrach for make some images.

But you can set it like this:
Content: Input “x” (The message content)
Conversation: Current cell “x” (Curent cell id)
Sent by: Current User

Thanks - I have it working great now :slight_smile:! Woohoo

@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).

See here:

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?

Do you have any ideas? Stuck on this one!

Any chance you were able to take a look @yusaney1? If not no problem!

Hey sorry bit busy with other projects.

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

1 Like

Thanks, that worked perfectly! I was already storing recipient, I just needed to reference it in the way you described. Many thanks :slight_smile:

Im glad that worked :sunglasses:

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