To create a new Contact record I have to first create a CreateContact (this is a multi step process due to not being able to do conditional mandatory for attributes and queries for drop downs that are conditional on the values of other attributes).
When I am creating a CreateContact I want to be able to associate the resultant Contact with another Contact and be able to utilise their addresses. The CreateContact may be the Primary or may be the Secondary so whichever it is I need to find the addresses of the other.
The data model looks roughly like this: While building up the CreateContact record I create a Relationship record and place the CreateContact into psCreateContact as a placeholder until the commit creates a Contact and inserts it into Primary or Subsidiary (the other one having already existed). When the Contact has been created then all of the psCreateContacts through the child BOs become UNDEFINED and the new Contact is put into obContact.
The challenge. While I am creating the CreateContact I can create addresses but may not if I already have an address for the Relationship contact.
When I create the CreateContact I place its ID into LIRU. I do not like placing the BO into LIRU as it creates lots of unnecessary SQL regardless of the BO status and those BOs end up having a huge spiderweb of child BOs - it's hard to then debug.
So to see the addresses that I have created for the CreateContact plus any addresses of related Contacts I have this:
Code: Select all
FIND Address WHERE Address.qCreateDeletable='No' AND ( Address.psCreateContact.ID=LoggedInRegularUser.CN0000ID OR
(Address.obContact=Relationship.pSubsidiary
WHERE EXISTS Relationship WHERE (Relationship.psCreateContact.ID=LoggedInRegularUser.CN0000ID))
Have I stared at this too long and missed something?