I have encountered a problem when sending mail with attachments. I have written the Script for an agent to send a reminder (Through mail) to user if the Purchase Request is not approved by him. In the reminder, I need to attach a document link, but the document link icon does not show in the mail. My Script is below--can you please help me to check where the error comes from?
Sub Initialize Dim session As New NotesSession Dim db As NotesDatabase Dim doc, doc1 As NotesDocument Dim rtitem As NotesRichTextItem Dim view As Notesview Dim status, prdate As String Set db = session.CurrentDatabase Set view = db.getview("Purchase Request By Ref No.") Set doc1 = view.GetFirstDocument Set doc = New NotesDocument( db ) Set rtitem = New NotesRichTextItem( doc, "Body" ) Do While Not doc1 Is Nothing status=doc1.PR_status1(0) prdate=doc1.PR_requestdate(0) If status="Pending" Then If Datevalue(prdate) < Now Then doc.Form = "Memo" doc.SendTo = "Tan" doc.Subject = "PR Approval Reminder !" doc.Body = "There is a PR that needs your immediate approval " Call rtitem.AppendDocLink(doc, "") Call doc.Send(True) End If End If Set doc1 = view.GetNextDocument(doc1) Loop End Sub
I think your problem is a simple one. When you append the doclink, you are attempting to append a link to the document you are creating (doc). Since this has not been saved, there is no document id to include. I think you really wish to send the link to the Purchase Request document. Try this code just above the send:
Call rtitem.AppendDocLink(doc1, "Purchase Request")
Dig Deeper on Lotus Notes Domino Administration Tools
Related Q&A from Brian Mahoney
Find out what types of calculations can be computed for a column in a Lotus Notes view and the best way to go about it with this expert response. Continue Reading
Find out why you can't use Formula language to include a doclink to a specific Lotus Notes view or database and need to use LotusScript instead. Continue Reading
Discover the reasons behind a Notes/Domino admistrator having trouble with disabled options in the "customize this view" section of his Lotus Notes ... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.