RichText field issue when scheduled in R8

Hi,

The issue I have is we are sending an email to mail-in-db from our application. There is a scheduled agent written in that mail-in-db to attach simple text in the Body field of the email that it receives. This agent is scheduled to run for every 30 minutes. The problem is the text is not attached in the Body field of the email though the agent is running for every 30 minutes. I tried running the agent manually in both R6 and R8 and it worked fine. I scheduled it in R6 and then also it worked fine. But when it is scheduled in R8, it doesn’t work. I have attached the code below. When it is scheduled in R8, it gives out the error “object variable not set” in the log at the line Set rtitem = doc.getfirstitem(“Body”) .The handle to rtitem is not obtained. When I looked into the document properties of the email received in mail-in-db, I found that the datatype of the Body field is mime-part. I guess this causes an issue in R8 which works in R6. Is this is the issue? Can you please suggest me any solution for it.

Dim s As New notessession

Dim db As notesdatabase

Dim col As notesdocumentcollection

Dim doc As notesdocument

Dim rtitem As notesrichtextitem



Set db = s.currentdatabase

Set col = db.unprocesseddocuments

Set doc = col.getfirstdocument



Do While Not doc Is Nothing

	If doc.From(0) = "PTAWEB@bankofny.com" Then

		Set rtitem = doc.getfirstitem("Body")

		Call rtitem.addnewline(2)

		Call rtitem.appendtext("Information Classification: Highly Confidential")

		Call doc.save(False, True)

	End If

	Set doc = col.getnextdocument(doc)

Loop

Any solution for the above issue is appreciated.

Subject: RE: RichText field issue when scheduled in R8

Well, the code looks fine.

Have you tried setting ConvertMime to True? It should be set to true by default, but you never know.

Also, do you have an ‘Option Declare’ or ‘Option Explicit’ statement in your ‘Options’ module? If not, I recommend adding one or the other. Probably not an issue, but it may point out a typo or something.