I have a form that assigns a task to a group of users. In the button that assigns it, I have code like this:
doc.status = “Assigned”
doc.DateAssigned = Today
Call doc.save(true, false)
…
Call uidoc.refresh()
Call uidoc.save
Call uidoc.Close(True)
…
ocassionally, i see a copy of the document out on the database. when looking at the edit history in this doc, the copy gets created after this button is pressed. The copy is not a response document nor a replication confict. Can you tell me if there is a chance if having doc.save and uidoc.save in the same sub might be causing this? I have been unable to recreate the problem. Let me know if you need more clarification. Thanks.
Subject: Duplicate documents using doc.save and uidoc.save?
Raymond,
I’d say that it may have something to do with what you do between using the doc.Save and the uidoc.Save…you haven’t shared the total code with us, so it’s hard to see. But there may be something between those two calls that is causing this behavior.
Subject: RE: Duplicate documents using doc.save and uidoc.save?
Thanks all,
I’ll try doing a reload and it doesn’t do it when I’m doing it. But its hard to tell at this point whether that solves the problem. It just ocassionally happens. I dont want to share the entire code because it is pretty long. Any suggestions/ideas are still welcomed. Thanks.
Subject: RE: Duplicate documents using doc.save and uidoc.save?
Hi Raymond
Did you ever resolve this issue. WE are having the same problem with one of our databases that perfroms multiple saves ona document after the user has clicked on the save button.
Subject: RE: Duplicate documents using doc.save and uidoc.save?
I have this same problem and I’m not even doing anything special. Might be a different issue altogether. The code below creates two documents at the save method. I’ve stuck a unique number as you can see and indeed the two documents have different numbers! The function is DEFINITELY not being called twice i have made sure of that. It is very bizarre and driving me bonkers.
Public Function RegisterUser (doc As notesDocument) As notesDocument
On Error Goto procErr
Dim s As New notessession
Dim OU1 As String
Dim OU2 As String
Set nn = New notesname (s.CurrentDatabase.Server)
Set nab = New NotesDatabase (s.currentdatabase.server, profile.NABPath(0))
Set pubNAB = New NotesDatabase (s.CurrentDatabase.Server,"names.nsf")
Set nabdoc = nab.createDocument
nabdoc.form = "Person"
nabdoc.type = "Person"
nabdoc.lastname = doc.conSurname(0)
nabdoc.firstname = doc.conGivenName(0)
nabdoc.middleinitial = doc.middleinitial(0)
Select Case doc.Form(0)
Case "SPReg"
OU2 = "SP"
Case "SReg"
OU2 = "S"
Case "UReg"
OU2 = "U"
End Select
OU1= Replace(doc.emailaddress(0), "@", "ATATAT")
Set nn = New notesname (doc.conGivenName(0) + " " + doc.conSurname(0) + "/" + OU2 + "/" + OU1 + "/iBookEasy")
fullnames(0) = nn.Canonical
fullnames(1) = doc.emailaddress(0)
nabdoc.fullname = fullnames
nabdoc.officephonenumber = doc.phone(0)
nabdoc.mailaddress = doc.emailaddress(0)
nabdoc.httppassword = doc.password(0)
nabdoc.companyname = doc.companyname(0)
nabdoc.officestreetaddress = doc.address(0)
nabdoc.officestreetaddress2 = doc.address2(0)
nabdoc.officecity = doc.city(0)
nabdoc.officestate = doc.state(0)
nabdoc.officezip = doc.zippostalcode(0)
nabdoc.officeprovinceregion = doc.provinceregion(0)
nabdoc.officecountry = doc.cntry_code(0)
Call nabdoc.ComputeWithForm(False, False)
nabdoc.unq = Evaluate ({@Unique})
Call nabdoc.Save(True, True)
Call nab.getview("($Users)").refresh()
Call pubNAB.getView ("($Users)").refresh()
doc.nabDocID = nabDoc.UniversalID
doc.DominoFullName = nn.Canonical
Call doc.save (True,False)
Set RegisterUser = nabdoc
Exit Function
Subject: RE: Duplicate documents using doc.save and uidoc.save?
I LIED! I revisited my belief that I wasn’t calling the function twice and discovered that I was calling the script in WebQuerySave and also in the button that instigated the save on the web form. My problem is solved.
Subject: RE: Duplicate documents using doc.save and uidoc.save?
the sub under the button does a whole slew of things along the whole process of the sub that justifies doing both the uidoc.save and doc.save. It will be complicated to talk about here. It does such as putting today’s date on the form and such things as changing one of the other date fields on the form.
As I mentioned, its no replication/save conflict. It is creating two documents. thanks.