Problems with a form appearing in email

I have a problem with a Lotus Notes form appearing properly in an email.

I am revising an existing application done by somebody else. There was a button on the form that saved the form and sent an email to locations depending on a selection on the form.

When I made my revisions, I noticed that in the email the form cut off after the first few fields. I looked at the code for the click event of the button and did not see much other than a few commands to send the form. (Along with code to direct the email).

A couple of days ago, however, the form was appearing OK in the email. I had changed a few things on the form, but nothing related to this in the code. Now, though it is not working again.

I have not been able to figure out why this is happening. I have included the code below. The code DOES contain some stuff I put in (a few lines as examples, current commented out) in order to populate the email with the field data. I did that because I could not figure out why the form cut off so I had to force the application to populate the email.

When this stuff started working, the code I put in was then creating extra unnecessary stuff, that is why it is currently commented out.

It did not appear to me this was a code issue. I figured there was something in my form that the application did not like, a hidden character perhaps, and that I had inadvertanly gotten rid of it the other day and thus the form was appearing in the email as originally intended. But now it is not, once again.

If anybody knows what could cause this, I would appreciate any tips.

Below is the code

Thanks,

Steve

Sub Click(Source As Button)

Dim NowWorkspace As New NotesUIWorkspace

Dim NowDoc As NotesUIDocument

Dim NowDocStd As NotesDocument

Set NowDoc = NowWorkspace.CurrentDocument

If NowDoc.FieldGetText( "Contractor" ) = "DMM_Cable_Service_North" Then

	ToNames$ = "dmm8377@adelphia.net"

Else

	If NowDoc.FieldGetText( "Contractor" ) = "DMM_Cable_Service_South" Then

		ToNames$ = "dmm8377@adelphia.net"

	

	End If

End If

Call NowDoc.FieldSetText( "Subject", "A New Buried Service Request Assignment for you!")

’ Call NowDoc.FieldSetText( “Body”, “Here is a new assignment for you!”)

Call NowDoc.FieldSetText( "SendTo", ToNames$)

’ add code to populate email

Dim rtitem As NotesRichTextItem

’ Dim line26 As String

’ Dim line27 As String

’ Dim line28 As String

’ line28 = "Tracking No: " + NowDoc.FieldGetText(“TrackingNum”)

’ line27 = "To: " + Nowdoc.FieldGetText(“contractor”)

’ line26 = "Area: " + NowDoc.FieldGetText(“Area”)

’ end of populate email

Call NowDoc.Save

Set NowDocStd = NowDoc.Document

’ Set rtitem = New NotesRichTextItem(NowDocStd,“ForMail”)

’ Call rtitem.AddNewline(1)

’ Call rtitem.AppendText(line28)

’ Call rtitem.AddNewline(1)

’ Call rtitem.AppendText(line27)

’ Call rtitem.AddNewline(1)

’ Call rtitem.AppendText(line26)

’ Call rtitem.AddNewline(1)

’ Call NowDoc.FieldSetText(“Body”,rtitem)

Call NowDocStd.Send(True)

Call NowDoc.Save

Call NowDoc.Close

End Sub

Subject: Problems with a form appearing in email

Steve, a couple of thoughts …1. Have you reviewed all the hide-when properties on the fields/sections of your form that disappear when it’s emailed? If there are any, try removing them, then re-run the code.

  1. According to Designer Help, you can’t attach a form in the NowDoc.Send that contains a computed subform. Check for that.

Generally, unless your email recipients need to edit the form once it arrives in their email, or it has form actions that they need to be able to use from their in-box, I always steer clear of emailing forms because they bloat up people’s email files. An alternative approach is to render the NowDoc document to a new RT “Body” field on a new temporary doc, add the appropriate Subject, To, and Form = “Memo” fields then send that temporary doc, and discard it afterwards. The email will arrive looking like your form was embedded in it but won’t take up nearly as much space. Anyway, it’s easy to do if you’re in the mood to try it.