How do I automatically delete a child record when afield in a parent record changes?

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

I have a status field in the parent record, when It changes I want the child record to be deleted.

Photo of Andrew


  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of itsjustchuck

itsjustchuck, Champion

  • 80 Points 75 badge 2x thumb
I recommend using the image onload technique to do this. Once you can inject javascript you can use the API to query the child table for its related parent. If you need a specific child record then just add that condition to your query. This will return the child record ID and you can use the API to delete it only if your field changes or changes to a specific value.