• Replication?

    By John Smart 2 decades ago

    Question:



    Does the save/modify event get triggered when someone replicates their changes to a trigger happy server?

    • Yes

      By Damien Katz 2 decades ago

      All document updates and deletes are caught by Trigger Happy, including replication updates and deletes.

    • Trouble getting a handle to the document during replication

      By Tom Hillebrand 2 decades ago

      I installed Trigger Happy and wrote an agent that runs when "a document is modified or saved". It works very slick in the database on the server. I get a handle to the document with session.documentContext.

      However, when I replicate a local database to the server database I'm having trouble getting a handle to the new/modified document that is being replicated to the server. During replication, the agent kicks off as expected for each new or modified document, but session.documentContext returns a 184 error that 'Variant does not contain a container'.



      ts.UniversalID does return the ID and I can get a handle to the database (using s.currentDatabase) and find the old document that is in the database. Here is a snippet or code. I read the sample agent and understand how to get the inMemory doc versus the onDisk doc, but in my example I can get the inMemory doc right off the bat. Does anyone have any suggestions for me?



      Sub Initialize()

      On Error Goto ErrorProc<br/>
      <br/>
      Dim s As New NotesSession<br/>
      Dim ts As New TriggerSession<br/>
      Dim docNew As NotesDocument<br/>
      Dim docOld As NotesDocument<br/>
      Dim db As NotesDatabase<br/>
      <br/>
      '*This section returns me the old document (the one on the server)<br/>
      Print ts.UniversalID<br/>
      Set db = s.CurrentDatabase<br/>
      Print db.Title<br/>
      Set docOld = db.GetDocumentByUNID(ts.UniversalID)<br/>
      Print docOld.form(0)<br/>
      <br/>
      '*This section is intended to get me a handle to the new/updated document <br/>
      ' * that is being replicated to the server.<br/>
      ' *The next line produces a 184 error<br/>
      Set docNew = s.DocumentContext<br/>
      Print docNew.form(0)<br/>
      <br/>
      Exit Sub    <br/>
      

      ErrorProc:

      Print &quot;Error: &quot; &amp; Err &amp; &quot; on line: &quot; &amp; Erl &amp; &quot; description: &quot; &amp; Error<br/>
      Exit Sub<br/>
      

      End Sub