LotusScipt Error in R6 not in R5. Any clue?

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

Subject: LotusScipt Error in R6 not in R5. Any clue?

Did you set the default frame in your frameset ?

I already saw some problem like this in R6 because no frame or the wrong frame is the default in the frameset.

To check this go into your frameset, select the frame you want to have the focus, select frame properties, go to the second tab and check the option set initial focus.

Maybe this will help.

Renaud

Subject: RE: LotusScipt Error in R6 not in R5. Any clue?

Thanks Renaud!! It’s solved with inital focus in the new frameset properties. Gosh…I traced the codes and thought should make adjustment to the codes.

Subject: RE: LotusScipt Error in R6 not in R5. Any clue?

Hi,I hit another similar problem when opening two framesets to transfer value from one db view from source frameset to another frameset but this time get an error “Object variable not set”

when do a Call uidoc.Refresh at the designated frameset.

I have checked the frame properties and set the focus frame. The script was fine in R5. What’s wrong in R6 again?

Sub Click(Source As Button)

Dim ses As New Notessession

Dim ws As New notesuiworkspace

Dim username As New Notesname(ses.username)

Dim uidoc As Notesuidocument

Dim result As Variant

Dim profiledoc As Notesdocument

	

Set curdb = ses.Currentdatabase

Set profiledoc = curdb.Getprofiledocument("Profile Form")

	

eSubdbname  = profiledoc.eSubFileName(0)

eSubServer = profiledoc.eSubServer(0)

Set submissiondb = ses.getdatabase(eSubServer,eSubdbname)	

result = Evaluate("@name([Canonicalize];@UserName)")

Set uidoc = ws.currentdocument	

Set col = curdb.UnprocessedDocuments



Set view = submissiondb.getview("Reference")

Key(0) = Cstr(username.Abbreviated)



For i = 1 To col.Count

    REM        chunks of codes to set values from source frame view to designated frame view form	

Next

	

view.Refresh

Call uidoc.Refresh

End Sub

Subject: RE: LotusScipt Error in R6 not in R5. Any clue?

Did you try to debug it ?

When does the uidoc variable loose it’s reference ?

I suppose it loose it’s reference when you do the view.refresh…

Renaud

Subject: RE: LotusScipt Error in R6 not in R5. Any clue?

Hi Renaud,

Yes, it seems to lose the reference in this version. This is coded with a based form with another new composed form to obtain the transferred values. The values are not refreshed over.

How to keep the reference since I need to do a view refresh? The debugging mode shows that the uidoc is not even set, hence error at uidoc.refresh.

I have already set set initial focus on the targetted frame. Still not working.

Think it has to do with the new frameset properties designed for R6.

Subject: RE: LotusScipt Error in R6 not in R5. Any clue?

Can you, just for testing purposes, put the view.refresh in comment and see if you still have the problem ?

If the problem is gone then is it possible to do the view.refresh after the uidoc.refresh ?

Renaud

Subject: RE: LotusScipt Error in R6 not in R5. Any clue?

Tried that before, it didn’t work. I traced both R6 and R5 version, R5 is able to Set uidoc = ws.currentdocument but not R6 in the transfer button click script from the source frame. Hence, object variable not set when do a uidoc.refresh.

Subject: RE: LotusScipt Error in R6 not in R5. Any clue?

Hi Renaud,

Found a workaround. Did a view.refresh. Remove the uidoc.refresh codes and do a Call ws.ReloadWindow( ).

Thanks for the help.

Regards,

Subject: RE: LotusScipt Error in R6 not in R5. Any clue?

I have the same problem with thr function Call ws.ReloadWindow, in postopen.

It work’s fine in R5, and doesn’t work in R6

Subject: RE: LotusScipt Error in R6 not in R5. Any clue?

I’m trying to work on the same problem - Cannot locate field

Here’s the code:

Sub Postopen(Source As Notesuidocument)

Dim workspace As New NotesUIWorkspace

Dim thisDoc As NotesUIDocument



Set thisDoc = workspace.currentDocument

Set dc = thisDoc.document

workspace.setTargetFrame "PreviewFrame"



Print "Open for Edit"

dc.form = "PreviewForm"

oldReason = ""



Set pViewDoc = workspace.editdocument (True,dc)



            pViewDoc.fieldSetText "vMode","X"

pViewDoc.fieldSetText "SaveOptions","0"

pViewDoc.refresh



workspace.setTargetFrame "EditFrame"

exitButton = 0

End Sub

It seems that setting the focus to the frame, PreviewFrame, is not taking effect since pViewDoc.fieldSetText “vMode”, “X” returns the cannot locate field error.

Field vMode is existing in PreviewForm. Above script is from another form, EditDetails Form. 'have a frameset, PreviewEditDetails, containing 2 frames (1) PreviewFrame and (2) EditFrame. Initial focus has been set to PreviewFrame.

Same script has been working in R5 client but not in R6 client. I already tried the workaround mentioned but still… no luck.

Any assistance is very much appreciated.

Subject: LotusScipt Error in R6 not in R5. Any clue?

I didn’t read your posting in detail , but the first paragraph of the description sounds similar to something that happened to us. It turned out that the frameset name we were using in the design was slightly mis-spelled in the script. While R5 was forgiving (I guess it took the closest match), R6 insisted on an exact match. So, recheck all the frame, frameset, view, etc. names against the code and be sure they are identical.

Subject: RE: LotusScipt Error in R6 not in R5. Any clue?

The frameset name is correct in the lotus script but somehow the statement Set uidoc = ws.Currentdocument after openframeset generates “cannot locate field error” in R6. There is no field value set for FieldSetText too.