How to run workflow on list of lists?

Hey all!

I’m working on a video scheduling app where I match two people for a video call if they are both available in at least one identical time slot

When a person registers for a call they are asked to mark all of their available time slots for the upcoming days, like this:

Each user has a data field of “Time_slots” which holds all of their available options:

After a user registers for a call, I want to trigger a backend workflow which will start checking (one by one) with all of the potential matches if they want to take the call or not

I’m trying to figure out a way to build the backend workflow right

At the moment I;m thinking about creating a workflow based on two lists:
First list (“outer”): all of the user’s available time slots
Second list (“inner”): Per each time slot from the above list, all of the available users with that timeslot

(Would you solve this in a different manner?)

So, I’m looking for a way to run a backend workflow that will take the list of time slots for the user and start checking with all the users that are available for the first time slot… then go on checking with all the users with the second time slot etc… till it reaches the last time slot from the “outer” list

  • The workflow need to check with people one by one and not in parallel
    ** If at any point someone takes the call the workflow needs to stop

Would love to get some inspiration on how you would do it :slight_smile:

I had a problem kind of like yours. I’ts a little tricky.

What I did is I created an object (that I named Schedule) in my db and associated it with the main object (for me, Article, for you, maybe the user).
In the outer loop, I start to count the inner loops that I will need to do (H3toDo) and then start by the first one. At the end of the inner loop, I increment H3sDone.
I have a “waiter” loop that calls itself every 5 sec until H3sDone = Iteration, which means that the first inner loop is done (or 2d, 3rd etc).

When H3sDone = H3toDo, it means that it’s done, and I can delete the schedule. To stop the loop, you could add a field “CallTaken” that when true stops the waiter and deletes the Schedule. You could do that by checking this field in the waiter workflow.

Note that for a simple double loop like this one I have several workflows, pretty ugly but it works :man_shrugging: