Why isn't the recipient getting the entire document when I sent a doc using LotusScript?

When I send (mail) a document using LotusScript, the recipient is not getting the entire document. I tried "doc.send(true,recipientname)," and the mail is being sent, but the document does not appear for the recipient.
I see you're sending with a stored form. I ordinarily advise against this, because it takes up a lot of room in the recipient's mail file and has other disadvantages, which I will discuss. I generally prefer to use RenderToRtItem to send them a Memo form whose rich text contains a copy of the document. Here's how you would do that:

Dim memo As New NotesDocument(db) 
' this can be done in any database 
memo.Form = "Memo" ' even if the 
current database doesn't contain a 
Memo form. 
memo.SendTo = recipientname 
memo.Subject = "insert subject line 
Dim body As New NotesRichTextItem
(memo, "Body") 
' At this point, if: 
'   - the document is in edit mode, and 
'   - the document may contain changes 
that have not been saved, and 
'   - the form has editable rich text fields 
or fields that need to be recalculated, 
' then insert the following line: 
'       Call source.Refresh(True) 
        Call doc.RenderToRTItem(body) 
        Call memo.Send(False) 
The recipient gets a regular memo with To and From fields and a subject, but the body of the memo is a copy of the document, as if you had selected Actions Forward.

If you do for some reason need to send the stored form, there are a couple of things that could be causing your problem.

  1. If your form contains subforms, the subforms are not mailed along with the form, so those entire sections will be missing when the user views the information in their inbox, unless the user happens to have the same subforms in their mail file.

  2. Likewise, any references to other design elements in your application, such as shared fields, shared actions, script libraries, etc., will not come through into the e-mail.

  3. If your form contains editable Rich Text fields, and these fields contain unsaved changes, then the Rich Text items in the back-end document returned by NotesUIDocument.CurrentDocument will not contain the latest changes. You must call NotesUIDocument.Refresh(True), as shown in the above example, to tell Notes to copy Rich Text changes from the UI document into the back-end document.

  4. If your form contains formulas that operate differently when in different databases, they will calculate different values when in the user's mail file than they do in your application. Remember that you are mailing the form with all its formulas. For instance, suppose you have a Computed for Display field with the following formula:

    tmp := @DbLookup(""; ""; "ItemsByID"; ItemID; "Description");
    @If(@IsError(tmp); ""; tmp)
    Since there is no ItemsByID view in the user's mail file, when the user opens the form in their mail file, the @DbLookup returns an error, and the value of the formula is "". Hence, the description would appear to be missing.

    The same thing can happen with any keyword fields whose keyword formulas use @DbLookup or @DbColumn.

Dig Deeper on LotusScript

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/Search400.com community. These cheat ...