I am at a loss.
I created a small script to make a new copy of a previously created document, with a couple of changes. I had it working. I made a backup of the original db. I continued making changes to the current db. Somewhere along the lines the “Revise” script ceased functioning. I copied and pasted the original script back into a button on the updated form and it will not work. It continues to work in the backup db. It fails at the same point every time in the latest version of the db. I’m looking for reasons as to why this is happening - is it changes to the form? Does the form have to be an exact match for the copy all items function to work. For whatever reason the newuidoc never gets set properly on this line “Set newuidoc…” I know I’m probably missing something basic but I really need to understand what I’m missing to get past this.
Any ideas?
(PS. You will be aware from the next bit that my scripting skills are limited… )
Sub Click(Source As Button)
Dim db As NotesDatabase
Dim workspace As New NotesUIWorkspace
Dim originaluidoc As NotesUIDocument
Dim newuidoc As NotesUIDocument
Dim originaldoc As NotesDocument
Dim newdoc As NotesDocument
Dim dateTime As New NotesDateTime( "" )
Call dateTime.SetNow
datestring = dateTime.DateOnly & " " & dateTime.TimeOnly
Set originaluidoc = workspace.CurrentDocument
Set newuidoc = workspace.ComposeDocument("", "","quote-cgl")
Set originaldoc = originaluidoc.document
Set newdoc = newuidoc.document
Call originaldoc.CopyAllItems( newdoc, True )
newdoc.policyID = originaldoc.policyID(0)
With newdoc
.quotedate = datestring
.revisionstatus = "Revised"
.author = ""
.fdEhEditor = ""
.fdEhDate =""
End With
Call originaluidoc.close
Call newuidoc.reload
newuidoc.editmode = True
End Sub