Deleting a thing and deleting that thing from all users who were part of that thing

Hi all, I’m having issues deleting a thing, a class in this instance, then deleting that class from all the teachers who were in that class.

So for instance, there is a class called “Third Grade” and that class has multiple teachers. However, when I delete this class, I also want to delete the class (ID in this case) from each teacher who was part of that class.

My DB is reasonably straight forward, I have a data type class “Class” and it has the following fields -
Name (text)
School (School)
Teachers (List of Users)

And my user data type has the following fields -
Name (Text)
School (School)
Classes Taught (List of Classes)

Now, it’s simple to delete the class, the problem is I want to delete the class for each teacher (user) that was connected to it. I know I could not do anything and it would be fine, but what’s the best way for me to delete it for each user? I’m trying to stay away from BE workflows (I don’t really understand who to do it) but it could also be my easiest option. Any suggestions would be appreciated!

Bubble will automatically delete the class on the user table since the class didn’t exist due it to be deleted first.

Before deleting A-103:


After deleting A-103:

2 Likes

I feel like an idiot! I just assumed I’d have to delete the relationship also. Thanks @biminmotion

1 Like

Your Welcome! :blush: :two_hearts: