LotusScript that worked great in 4.6.7 but no longer works correctly in 6.5.3

Below is the code that is used in a ‘Call Log’ within our company’s Sales Force Automation system. The purpose of this code is to add new comments to the top of the existing comments within the log. If the field exceeds its allowed size a message is given to the user, the current log is closed out and new one is created with the user’s new comments. This worked greate in 4.6.7, however in 6.5.3 the error 4412 is not being returned. On save the document in 6.5.3 is giving the error ‘Field is too large (32K)’. I tried to trap this error in several different events to get the error code to test for but have had no luch trapping it.

Can anyone help me with the below code to make it work in 6.5.3?

Thank you :o)


Sub Click(Source As Button)

 On Error 4412 Goto ProcessError

 Dim newentry As String

 Dim oldentries As String

 Dim session As New NotesSession     

 Dim workspace As New NotesUIWorkspace

 Dim uidoc As NotesUIDocument

 

 Set uidoc = workspace.CurrentDocument

 If  uidoc.FieldGetText( "CallReport" ) <> "" Then

      oldentries = uidoc.FieldGetText( "ReportHistory")

      newentry =  Today() & " " & session.CommonUserName & " - " &  uidoc.FieldGetText( "CallType") &_

      "  " & "Purpose of Call:  " & uidoc.FieldGetText( "Subjectofcall") & "     Attendees:  " & uidoc.FieldGetText( "CustAttendees") &_

      Chr(10) & "Call Report:  " & uidoc.FieldGetText( "CallReport")  & Chr(10) & String$(78, Asc("-")) & Chr(10)

      Call uidoc.FieldSetText( "ReportHistory",newentry & oldentries) 

      Call uidoc.FieldSetText( "Subjectofcall","") 

      Call uidoc.FieldSetText( "CallType","")

      Call uidoc.FieldSetText( "CallReport","")

      Call uidoc.FieldAppendText("ListAttendees", "," & uidoc.FieldGetText( "CustAttendees"))

 End If

 Exit Sub

ProcessError:

 Dim doc As NotesDocument

 Dim parent As NotesDocument

 

 Set doc = uidoc.Document

 

 Dim db As NotesDatabase

 Set db = session.CurrentDatabase

 Set parent = db.GetDocumentByUNID( doc.ParentDocumentUNID )

 

 Messagebox Str(Err) & ": " & Error$ & Chr(10) & "The current log will be closed. A new one will be created with the last call report pasted in."

 Call uidoc.FieldSetText("Status","Closed")     

’ New 03/16/2005 --------

 Call uidoc.FieldSetText( "ReportHistory", oldentries)

'--------------------------------------

 Call uidoc.GoToField( "CallReport" )

 Call uidoc.SelectAll

 Call uidoc.Copy

 Call uidoc.FieldSetText( "Subjectofcall","") 

 Call uidoc.FieldSetText( "CallType","")

 Call uidoc.FieldSetText( "CallReport","")

 Call uidoc.save

 Call uidoc.Close

 

 Set uidoc =  workspace.ComposeDocument( "", "", "Call Log" )

 Set doc = uidoc.Document

 Call doc.MakeResponse( parent )

 

 Call uidoc.GotoField( "CallReport" )

 Call uidoc.Paste     

 Call uidoc.FieldSetText( "Status","")

’ Call uidoc.FieldSetText( “$Ref”,saveref)

 Call uidoc.GotoField( "Subjectofcall" )

’ Messagebox Str(Err) & ": " & Error$

 Exit Sub

End Sub

Subject: LotusScript that worked great in 4.6.7 but no longer works correctly in 6.5.3

Although I havn’t check your code line per line, one thing that pops in my head is that you are doing everything through the user interface, on the front end.

Why is that? The front end is tricky to work with, it has serious limitations, it is slower, and it is dependend of the form currently opened.

This kind of process should be computed in the backend, then all you need to do is call a refresh in the front end to see the results.

I am not positive you’d be able to handle the 32K limit that way, but you might - and even if you don’t, it will be a lot more performant.

Also, you can try converting your text fields to rich text fields, where you can definitly put more than 32K data. But of course, it will be harder to work with it.

Hoping this helped,

Nicolas Abesdris

Quintessence e-solutions Inc.

Subject: Find the line where the error is occurring

Since I don’t think LS debugging will work in the UI, put msgbox “1”, msgbox “2”, etc. between the lines of code and find out where the error is.

Or you could use On Error GoTo ProcessError at the top, and put …

Msgbox “Error” & Cstr(Err) & " at line " & Cstr(Erl) & ": " & Error$

in ProcessError.

Subject: RE: Find the line where the error is occurring

I have tried this already. I do not believe the error is actually in my code because my code is executed from a button and the error that I am now getting in 6.5.3 is appearing when the document is saved. The field that is being populated by the user while in EDIT mode is a text field and upon saving the document they are receiving the error mentioned in the main post. I can change the field to a Rich Text field, however, I am concerned that they will get the same error once this field fills up. I would like to be able to trap this error so that I can test for it but I have not been able to.

Subject: RE: Find the line where the error is occurring

  1. a rich text field will not fill up. It might get paragraphs that exceed 64k bytes, but it won’t fill up.

  2. if you don’t think your error is occurring in your script, why is your On Error statement in the script? Where else do you have an On Error statement? Have you turned on LS debugging? If so, what was the the result?