Retrieve the form from one document and place it into an RTF on another form

781 Views Asked by At

I have an mail-in database where the mailDoc is a table of values retrieved from the incoming email. Nothing special, it just makes it easier to work with this way. I have a scheduled agent that reads these incoming emails and processes them to determine validity of attachments and client names. When I encounter an invalid attachment, I need to send an email to the sender with a copy of the original email (everything in the table) under some text that I have created explaining the error.

I have tried to use RenderToRTItem and set it to the existing Body field on this new (outgoing) email. From what the Help doc states, RenderToRTItem requires that I save the email prior to using this function. The problem is I do not want to save these emails.

RenderToRTItem, without a save, did retrieve the attachment from the mailDoc and placed it under a line on the email, but I need to retrieve the entire form not just the attachment.

How do I retrieve all of the data from the mailDoc form, place it into the Body field on the memoDoc under text that is already added?

4

There are 4 best solutions below

2
Ken Pespisa On

You (likely) won't be able to work around the requirement to save the document first, but why not save the document and then delete it later? You could set an item on the document "ToBeDeleted" and then create another scheduled agent to delete all documents having that item.

3
Richard Schwartz On

Based on your response to Ken's answer:

Try creating a new dummy NotesRichTextItem. Do your RenderToRTItem into that dummy item. Then call BodyItem.appendRTItem(dummyRTItem).

0
Emmanuel Gleizer On

Try the following work around to avoid saving the document:
1 add a saveoptions field with value "0"
2 SAVE the doc (it won't be really saved)
3 test if the RenderToRTItem works

I didn't use this trick for RenderToRTItem but it works for many other similar needs.

1
David Navarre On

If you only want the contents of the email, why don't you add your text to the Body of the new email, then just use an AppendRTItem to append the original emails contents to the Body?