Hi There,
Bit of a strange problem, I have the following script which allows the user to edit the email before sending it to the required recipient. It works fine when i debug it, but when I run through it normally or even with msgboxes, it gives me the error ’ Cannot locate field’. it has finished the script by this point, but opens the email in the same window and not a new one (not sure if its causing the problem)
Code :
Sub SendCreatorEmail(docCurrent As NotesDocument,strStatus)
Dim s As New NotesSession
Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim docMail As NotesDocument
Dim rtitem As NotesRichTextItem
Dim uidoc As NotesUIDocument
Dim MailDb As New NotesDatabase( "", "" )
Call MailDb.OpenMail
Dim v As NotesView
Dim TDoc As NotesDocument
Set db = session.CurrentDatabase
Set docMail = MailDb.CreateDocument
Set nam = s.CreateName(docCurrent.CreatedBy(0))
Set v = db.getview("Team")
Set TDoc = v.GetDocumentByKey(nam.Abbreviated)
docMail.Form = "Memo"
docMail.SignOnSend = False
If TDoc Is Nothing Then
Msgbox "Please Check Assignee exists in the Team Members List."
End If
docMail.SendTo = TDoc.TMEmailAddress(0)
docMail.Subject = "Your Rubicon Issue has been marked as " & strStatus
Set rtitem = docMail.CreateRichTextItem("Body")
Call rtitem.AppendText("Hi There,")
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText("A Rubicon Issue you raised in the Rubicon Issue Logging System has now been marked as " & strStatus & ".")
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText("The reported issue was :")
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText("'" & docCurrent.Problem(0) & "'")
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText("The reported fix for this issue was :")
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText("'" & docCurrent.Resolution(0) & "'")
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText("Can you please check that the issue has been closed out to your satisfaction and if not, raise another issue referencing this one.")
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText("Click the link to view more details about this issue..............")
Call rtitem.AppendDocLink(docCurrent, "Link to action.")
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText("Thanks")
Call rtitem.AddNewLine( 2 )
Call rtitem.AppendText(s.CommonUserName)
Delete rtitem
Call docMail.Save(True,True)
Set uidoc = ws.EditDocument(True,docMail)
End Sub
Any suggestions as to what might be wrong?
Thanks
F1H