I have a master app and a detail app. The detail app is linked to the master app as incoming. I want to delete the associated detail records when a master record is deleted.
This is an interesting one, thanks for posting. I have to admit I first read it on my phone and thought you were asking how to do it so I went off and worked through the problem myself and it is not as simple to solve as one might think.
Your solution is quite different from mine, which shows there are nearly always multiple ways to achieve the same thing, I like yours it is nice and neat and has no-code which I always think is good (mine had code).
One thing I would say is that it would be a lot easier to do if the Delete the current record didn’t trigger the When record is deleted when it is set to not be a trigger I am not sure if that is as intended or not:
Hi Jason, I’m with you on that. Thanks for your feedback! I’m curious about your solution. Is there any reason not to share it? Often, not every approach is the best in every scenario.
Totaly and I can:
As you no doubt found the biggest battle is to not end up in a loop. Having looked at my solution again I am not convinced I have managed to avoid that! (I blame a lack of coffee!)
So for now the only relevant part of my solution that is different to yours is the way I was deleting the sub-records, which was by calling a simple automation to delete the collected sub-records.
I also find it interesting that we can filter the automation trigger based on the value of a deleted record but can’t retrieve the previous values.
The other way I thought of solving the issue relied on the fact that every sub-record was always related to a master unless the master had been deleted, if that was the case then a simple automation to search the sub-records for any that are not related to a master and then delete any that were found:
As for the coffee, I can only help you with a virtual one. I just turned on the coffee machine.
Regarding your initial thought that a sub-record must always be linked to a master record, your solution fits perfectly. That approach hadn’t even crossed my mind.
Actually isn’t that a cascaded delete? I would also put this into the “feature request” section, this is part of functionality in other LowCode platforms as well. Thanks for sharing the workaround @Hans!