I just learned that when I delete a thing via workflow, the data associated with that thing does get deleted from the database.
Eg. I have a Course thing, where each course has a list of lesson (another thing). Each lesson in turn saves a list of resources (type file). When a course is deleted, the data associated with it (lessons and their resources) are not deleted from the database (kinda stupid and weird), but how can I set up a workflow to delete everything when a course thing is deleted.
I understand their are no âforâ loops in bubble. How to achieve the above in the simplest way?
@emmanuel @keith @NigelG
This is actually handy because in some instances you donât want to delete all the data associated with the deleted thingâŚwithout it you wouldnât be able to use a data type as a field for relations because youâd end up deleting things you didnât want to because they were related.
Also, Iâve set things up in projects before where the User is an employee and all of their data is owned by the employer who pays for the platform, so if the user is going to be deleted we donât delete all of their data, we simply reassign it to a different employee.
There are loops. In backend workflow you can do ârecursive workflowsâ which loops. I also recently learned of a free plugin that does loopsâŚcanât recall name but something like âlooperâ.
There are lots of ways to go about this, but would probably be in the backend workflows section. I just set this up tonight in an app of mine for a User deleting their account and needing to delete all data associated for another 6 types of data. Did all in backend. Some used action to delete list of things and I just did a search with constraints using my parameter key values set on the backend workflow. Others I did recursive backend workflows to loop through the list I sent.
2 Likes
Check out Backend Workflows as @boston85719 mentioned. Then create a DB Trigger on the Course thing. Try setting âOnly when thing before is not empty and thing now is emptyâ and put âDelete a list of thingsâ in this workflow.
1 Like
@codecompany @boston85719
Thanks a lot guys.
If itâs not too much trouble to ask, can you guys paste an example recursive workflow.
So many different ways to set them up that an example isnât necessarily going to explain how to do it for your needs.
Search the forum for recursive workflows and maybe the Bubble reference to have a better idea of how to set them up.