Domino Code Fragment

Code Name*
How to make the "loser" of a replication/save conflict be the "winner"?
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.3.144.193.129
Description*
When you select the "loser" document and run this agent, it will be promoted to be a replication "winner". You can then delete the original "winner" document. Put this code into an agent that runs on selected documents:
Type*
LotusScript
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Sub Initialize
 ' From Kevin Pauli (kcpauli@usa.net)
 Dim session As New NotesSession
 Set db = session.CurrentDatabase
 Set collection = db.UnprocessedDocuments
 Set doc = collection.GetFirstDocument
 Call doc.RemoveItem( "$Conflict" )
 If doc.IsResponse Then
   Set parent = db.GetDocumentByUNID( doc.ParentDocumentUNID )
   If parent.IsResponse Then
     Dim grandParent As NotesDocument
     Set grandParent = db.GetDocumentByUNID(parent.ParentDocumentUNID )
     Call doc.MakeResponse( grandParent )
   Else
     Call doc.RemoveItem( "$REF" )
   End If
 End If
 Call doc.Save( True, True )
End Sub