AnsweredAssumed Answered

Deleting Related Records

Question asked by Vinny on Jun 3, 2012
Latest reply on Jun 3, 2012 by philmodjunk

Title

Deleting Related Records & Popups

Post

I have a relationship: Customers >- Types.

On the customers layout, there is a popup to select a customer "type".  I would like to allow the user to delete a "type" even if it is currently related to a customer (or customers).

The result I would like is: for those customer records which were related to the now deleted type, the popup will be blank as a result of the Type being deleted.

The popup is using a foreign key to the Types table's ID field (auto serial on create), and a value list of all types from the types table (first field ID, second field type name).

When a type is deleted, any customer record which was linked to it, now shows the old type's ID number in the popup.  I would expect that now that the child item has been deleted, the popup / related field would revert to "" (nothing).

What is the best way to protect / remedy this?

I can easily write a script to go to a customers layout and remove all the "broken" links to the types table, but this seems like a lot of work todo...

Is there a better way of looking at this?  FYI, I have many other instances of this issue; this is just a basic one. However, if I can make a strategy for this example, I'm hoping to re-use it across my solution.

Also, this is a case where I don't want to stop the user from deleting the type record even though there are parent records using it.  I simply want the parent record's reference to be returned to "nothing".

Outcomes