• Problems Synchronizing Children

    By Dave Leigh 2 decades ago

    Jon Soderquist has submitted several changes to make sure that documents get synchronized on save as intended.



    He also reports that fSynchChildren isn't working properly. At certain points, the Contact_to_Contact fieldmap will be used and it will overwrite the Org_ID with a blank.

    • Reason for fSynchChildren problem

      By Dave Leigh 2 decades ago

      Normally the first item in the Source list in the fieldmap doc is the UniqueID of the current document (or a similar key). That's used to set the relationship with whatever field is to be found in the first position of the Destination list. (usually this is express in English as, "My ID is your Parent ID").



      BUT… the Contact_to_Contact fieldmap is only intended to be used for creating a new contact with the same relationship as the existing one. It was never intended to be used for updating those relationships (that would happen through the Organization_to_Contact, as both the old and the newly created contact would be related to the same Org… follow me?).



      So, unlike the other fieldmaps, Contact_to_Contact doesn't have the original contact's UniqueID as the first item in the Source column (since a contact can't be another contact's parent). At design time I figured it would simply fail and move on, as it should never find the current Contact document's UniqueID ("cParentKey" in the synch scripts) in another Contact document's Org_ID field. Obviously though, something must be happening there. I suspect that it's happening with new documents where the UniqueID is still blank on the backend doc?



      The only Same_to_Same relationship followed in the synch scripts should be Organization_to_Organization, since one org can be another's parent. I've put a test in the fSynchChildren function to enforce this explicitly (mostly so this is obvious to other programmers). Some other changes should prevent this from condition from happening in the first place.

    • Jon's changes

      By Dave Leigh 2 decades ago

      Here are some more of Jon's changes. All will appear in the next release.

      ———————

      In Index.ntf - Contact Form - Postopen Event - removed all code. This was leftover Formula Language stuff which should all be unnecessary now.

      ———————

      In Index.ntf - Contact Form - Querysave Event - replaced Call fBuildAssociations(…)

          'JES 4/7/05 - updated so the Associations field is actually updated <br/>
          'Call fBuildAssociations(Source.Document) <br/>
          <br/>
          Dim doc As NotesDocument <br/>
          Set doc = Source.Document <br/>
          doc.Associations =  fBuildAssociations(Source.Document) <br/>
      

      ———————

      In Index.ntf - Organization Form - Postopen Event - removed all code. Same reason as above.

      ———————

      In Index.ntf - Organization Form - Querysave Event - - replaced Call fBuildAssociations(…)

          'JES 4/7/05 - updated so the Associations field is actually updated <br/>
          'Call fBuildAssociations(Source.Document) <br/>
          <br/>
          Dim doc As NotesDocument <br/>
          Set doc = Source.Document <br/>
          doc.Associations =  fBuildAssociations(Source.Document) <br/>
      



      ———————

      In Config.ntf - CratchitCommonLibrary - fBuildAssociates - replaced 'Case "Person"'


          'JES 4-07-05 - modified to accomodate &quot;Contact&quot; alias                 <br/>
          'Case &quot;Person&quot;                 <br/>
          Case &quot;Contact&quot; <br/>
                  Redim tmp_fields(1)