1

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?

RoyRumaner
  • 769
  • 1
  • 9
  • 29

4 Answers4

0

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.

Ken Pespisa
  • 21,989
  • 3
  • 55
  • 63
  • I have added a save to the code and found that that is not what is keeping this from working. It seems that RenderToRTItem removes anything in the Body field before it puts its contents in there which really defeats the purpose. – RoyRumaner May 08 '12 at 22:14
  • Thanks for the ideas. I ended up using AppendRTItem and got it to work. – RoyRumaner May 09 '12 at 14:28
0

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).

Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41
  • I tried that as well. It returned the text but not the form from the other document. Again it appears to have been overwritten. – RoyRumaner May 09 '12 at 04:08
  • Okay... I'm really unclear on what you mean by 'returned the text but not the form' in this case. I think you may need to post code and pictures of the mail-in doc and of the result you are getting. Just one more thought here: could you be running into Hide When formulas that make it look like data from the form wasn't copied, even though it really is there? – Richard Schwartz May 09 '12 at 10:44
  • I ended up changing the code to use AppendRTItem instead and I got it to work. RendnerToRIItem just would not do what I wanted. Thank you for trying to help. – RoyRumaner May 09 '12 at 14:27
0

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.

Emmanuel Gleizer
  • 1,990
  • 16
  • 26
0

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?

David Navarre
  • 1,022
  • 10
  • 27