I'm working on a solution for a school. In one part of the solution I have to organize people into families. What I have done is create a contact table that holds both the family records as well as the people records.
Then there is a Related table that links families to people in a many to many relationship. The reason it's many to many is that a child may be part of more than one family in the case of joint custody.
Contact records have, among other fields:
ID - record ID
contactType - identifies if this is a person, family, church or business.
CONTACT(family) RELATED CONTACT(person)
ID >> id_family
id_person >> ID
The relationship between CONTACT(family) & RELATED is set to allow record creation. Neither relationship is set to delete related records.
On the family layout there is a portal using the TO, RELATED, listing all the family members. Here is the sequence of events that leads to the problem.
1. I create a CONTACT(family) record
2. I create a couple of CONTACT(person) records.
3. I link the person records to the family by creating appropriate RELATED records.
4. Now I decide to break the relationship between the family and one of the persons. I delete the RELATED record using a script that first confirms that the user really wants to delete this and then does a Delete Portal Row [no Dialog].
The problem is that BOTH the RELATED record and the CONTACT(person) record are deleted! This happens even if I open one of my developer layouts that only lists RELATED records. If I manually delete the RELATED record, the CONTACT(person) record also is deleted. The CONTACT(family) record remains intact.
Help with this would be greatly appreciated.
Thanks in advance.