1 TRIGGER PROCEDURE FOR WRITE OF ContactType
NEW NewType
OLD OldType.
3 DEF BUFFER OtherContact
FOR Contact.
4 IF AVAILABLE(NewType
) AND AVAILABLE(OldType
)
5 AND NewType.ContactType
<> OldType.ContactType
7 /* Change all the contacts with this type to the new type
*/
8 /* delete any where a new type of that contact already exists
*/
9 /* Note that we never delete
"Person" records
*/
10 FOR EACH Contact
WHERE Contact.ContactType
= OldType.ContactType
EXCLUSIVE-LOCK:
11 IF CAN-FIND( OtherContact
WHERE OtherContact.ContactType
= NewType.ContactType
12 AND OtherContact.PersonCode
= Contact.PersonCode
) THEN
15 Contact.ContactType
= NewType.ContactType.