The script works fine in R5 but not R6.2 errors msg box. 1)Notes Error - Cannot locate field. Cannot locate Field error occurs at line Set uidoc = ws.currentdocument 2) Invalid Universal ID when escape from Frameset.
Appreciate help in this, have a hard time debugging the script. The lotusscript of the button opens a Frameset View to copy a value from another database view to the current uidoc field value - txtFileRefNo of a subform:
Sub Click(Source As Button)
Dim ws As New Notesuiworkspace
Dim uidoc As Notesuidocument
Dim doc As Notesdocument
Dim Newdoc As Notesdocument
Dim curdoc As Notesdocument
Set uidoc = ws.currentdocument
Set doc = uidoc.document
Set rtitem = doc.Getfirstitem(“txtContent”)
Call uidoc.Save
Call uidoc.Close
Call ws.OpenFrameset(“FSLookup”)
Set uidoc = ws.Currentdocument
Set Newdoc = uidoc.document
Call Newdoc.ReplaceitemValue(“txtFileRefNo”, doc.txtFileRefNo)
Call uidoc.Fieldsettext(“ParentUNID” , doc.UniversalID)
Call uidoc.Fieldsettext(“txtTitle” , Cstr(doc.txtTitle(0)))
uidoc.AutoReload = True
End Sub
From the Frameset View, I have the button LotusScript to copy the value over:
Sub Click(Source As Button)
Dim ses As New Notessession
Dim ws As New notesuiworkspace
Dim db As Notesdatabase
Dim col As Notesdocumentcollection
Dim ReferenceNumbers() As String
Dim Referencedoc As Notesdocument
Dim DocID As String
Dim submissiondb As Notesdatabase
Dim submissiondoc As notesdocument
Dim uidoc As Notesuidocument
Dim doc As Notesdocument
Dim Item As Notesitem
Dim profiledoc As Notesdocument
Dim eSubdbname As String
Dim eSubServer As String
Set db = ses.currentdatabase
Set profiledoc = db.Getprofiledocument(“Profile Form”)
eSubdbname = profiledoc.eSubFileName(0)
eSubServer = profiledoc.eSubServer(0)
Set submissiondb = ses.getdatabase(eSubServer,eSubdbname)
DocID = ses.GetEnvironmentString( “SubmissionID” )
Set col = db.UnprocessedDocuments
If col.count = 0 Then Exit Sub
Redim ReferenceNumbers(Cint(col.count) - 1)
For i = 1 To col.Count
Set Referencedoc = col.Getnthdocument(i)
ReferenceNumbers(i - 1) = Cstr(Referencedoc.Fileref(0))
Next
Set uidoc = ws.CurrentDocument
Set doc = uidoc.Document
If doc.txtFileRefNo(0) <> "" Then
Set item = doc.getfirstitem("txtFileRefNo")
Call item.Appendtotextlist(ReferenceNumbers)
Else
doc.txtFileRefNo = ReferenceNumbers
End If
uidoc.refresh
End Sub