I know there are plenty of references to this topic in this forum but I could not find one that helped me understand why I am getting a replication/save conflict.
Here is the scenario:
I have a web application. Some of the settings in a document are preserved with a Webqueryopen. If the user changes some of the fields and then saves the document, a history of those changes are saved in a history field. The problem is that when I run this agent from the web it generates a replication/save conflict. It does not if I manually run it from the client against the same document.
-I have changed the place where the save happens since I read references to having more than one save,
-there are no replicas of this DB because there is only one server
-I am the only one using this DB.
-I just turned on Merge/No Conflict in the form being used
The Button that triggers the agent does the following:
@Command([ToolsRunMacro]; “document any changes”);
@Command([FileSave]);
@Command([OpenView];“lapinv”)
The LS agent is as follows:
Sub Initialize
Dim s As New NotesSession
Dim db As NotesDatabase
Dim news As String
Dim st As String
Dim note As NotesDocument
Dim nowdatetime As New NotesDateTime(" ")
Call nowdatetime.SetNow
Set db = s.CurrentDatabase
Set note = s.DocumentContext
changes = "0"
note.modifiedby = note.current_user(0)
If note.starting_laptopnumber(0) <> note.laptopnumber(0) Then
note.commenthistory = note.commenthistory(0) + ";"+ note.current_user(0) + " - " + nowdatetime.Localtime + " - changed laptop number from " + note.starting_laptopnumber(0) + " to " + note.laptopnumber(0)
changes = "1"
End If
If note.starting_laptopserialnumber(0) <> note.laptopserialnumber(0) Then
note.commenthistory = note.commenthistory(0) + ";"+ note.current_user(0) + " - " + nowdatetime.Localtime + " - changed laptop serial number from " + note.starting_laptopserialnumber(0) + " to " + note.laptopserialnumber(0)
changes = "1"
End If
If note.starting_laptopstatus(0) <> note.laptopstatus(0) Then
If note.starting_laptopstatus(0) = "a" Then
st="available"
Elseif note.starting_laptopstatus(0) = "b" Then
st="broken"
Elseif note.starting_laptopstatus(0) = "c" Then
st="checked out"
Elseif note.starting_laptopstatus(0) = "r" Then
st="out for repairs"
End If
If note.laptopstatus(0) = "a" Then
news="available"
Elseif note.laptopstatus(0) = "b" Then
news="broken"
Elseif note.laptopstatus(0) = "c" Then
news="checked out"
Elseif note.laptopstatus(0) = "r" Then
news="out for repairs"
End If
note.commenthistory = note.commenthistory(0) + ";"+ note.current_user(0) + " - " + nowdatetime.Localtime + " - changed laptop status from " + st + " to " + news
changes = "1"
End If
If note.starting_laptoppropertytag(0) <> note.laptoppropertytag(0) Then
note.commenthistory = note.commenthistory(0) + ";"+ note.current_user(0) + " - " + nowdatetime.Localtime + " - changed laptop property tag from " + note.starting_laptoppropertytag(0) + " to " + note.laptoppropertytag(0)
changes = "1"
End If
If (changes="1") And (note.comment(0) <> "") Then
note.commenthistory = note.commenthistory(0) + ";" + note.current_user(0) + " - " + nowdatetime.Localtime + " - updated this document. Comment was: " + note.comment(0)
note.comment = ""
End If
End Sub
So, what am I missing? Someone can please tell me what I am doing wrong? Someone more awake than I am after staring at this all this afternoon…
Thanks in advance
Cynthai