It looks like the database trigger works on change within a data type, but not if a thing gets deleted?
Trigger when thing is deleted
Create a trigger → Only When → [thing] before is not empty and [thing] now is empty
Trigger when thing is created
Create a trigger → Only When → [thing] before is empty and [thing] now is not empty
I hope this helps!
Just realize you can’t actually reference the thing before anymore to do deletion chaining of others things in the subsequent workflow right? I assume that’s because it has already been deleted?
@redvivi this sounds like a case where you might need two additional states on the Thing in question: One that makes it “Marked for death” (do all of the pre-deletion things) and second in which it’s “Ready to die” (now just delete it).
Agreed. @keith
@redvivi
Setup
- Add a field to your thing called “deleted” and make it type yes/no
- Default to no
- Create a trigger → Only When → [thing] before’s deleted = no and [thing] now’s deleted = yes
- Add all the steps you want to complete under that trigger.
- Make one of the last steps of the above trigger “delete thing”
When you want to delete that thing
- Change things “deleted” field to “yes”
This will cause the trigger to fire
quick q: since you mentioned “deletion chaining” are the “things” you are referring to related with the data that you’re trying to delete?
Yep, @Dillon_Schade, though I think my labels are more fun.
I’m inspired and ill start adding “markedForDeath” on future things
Thanks a lot for all your help.
I managed to sort it out.
I also trashed my computer science database design courses related to referential integrity.
Make of it what you will.
It’s a shame bubble doesn’t have a trigger method that would run before the CRUD operation, like a “before delete” trigger so that we could do the process you just mentioned without the extra field and pre-delete update to the thing ; also this would allow the delete function from the bubble editor to un the trigger properly.
Vote for this feature here