Comparing two list of things

Hi All,

I’ve been stuck on something for a few days and wanted to get the community’s help since I expect others may have had to solve for this. I recently built a direct messaging system for users in our app. I have two relevant data types - Thread and Messages. Each thread contains a list of users and a list of messages. Each message is associated with a Thread, and has other fields including Read By (List of Users), Sender (user) and Body (text).

The flow is as follows:

  1. User presses a button opening a popup where they can select users to add to the Thread. The selected List of users are stored in a custom state
  2. Create button creates the Thread, adding the list of users from the custom state, and opens the chat window

I want to prevent users from creating a Thread that contains the same list of users as any Thread existing in the database. For example, if John, Sally, and Louis already have a conversation Thread created, I want to alert John and prevent the creation of an additional Thread if John attempts to create a Thread containing Sally and Louis, via workflows. Has anyone had to do something similar and had success? Many thanks.

Hi there, @dondre… if I understand your post correctly, you could put a condition on the action that creates a new thread, and I believe you would need to use an advanced filter in the condition. I haven’t tested it, but I believe either one of the following conditions/filters would work.

What I am showing there would stop the creation of a new thread that has the same participants the user has selected. You would have to take it from there and decide how you want to show an associated alert (which might involve putting the condition on a different workflow action and modifying the condition a bit), but hopefully those conditions help you get down a good path.


1 Like

Thank you so much for this, Mike! I completely overlooked the Advanced Filter but this solution worked perfectly.

1 Like

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