• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 273
  • Last Modified:

LotusScript ver 6.5.1 - how to place contents of Notesitem into body of email

The function of errorlist is to accumulate error descriptions when an error occurs.  This works just fine.

Now, I want to send an email with the content  of errorlist, but I am having no success.  This line of code  (below) "str3 = Str(errorlist)" is not working.....
Need help on correct method to place content of errorlist into body of email.
thanks....
 

                  Dim Str3             As String
                  Dim newvalue(1)       As String
                  Dim errorlist              AS NotesItem

                  If PRhasOCOGMark = "Y" And FoundOCOG = "N" Then
                        Set  errorlist = docPR.GetFirstitem("ProdREQ_ErrorCode")
                        newvalue(1) = "Missing OCOG Split Rate for Contract"
                        Call errorlist.AppendToTextList(newvalue)
                  End If
                  
                  If PRhasNGBMark = "Y" And FoundNGB = "N" Then
                        Set  errorlist = docPR.GetFirstitem("ProdREQ_ErrorCode")
                        newvalue(1) = "Missing NGR Split Rate for Contract"
                        Call errorlist.AppendToTextList(newvalue)
                  End If
                  
                  If docPR.ProdReq_ErrorCode(0) = ""  Then
                        run_status = "OK"
                  Else
                        run_Status = "NO"
                  End If
                  
                  If run_status = "OK"  Then
                        docPR.ProdREQ_Status = "Active"
                  Else    
                        docPR.ProdREQ_Status = "Error"
                     REM ****************************************************************
                                                   REM send an email about the error
                     REM Set up the memo to email --Product request has errors
                     REM *******************************************************************      
                        Set docMail = db.CreateDocument
                        
                        docMail.Form = "Memo"
                        docMail.Subject = "An error has occured during the processing of the Licensee Request"
                        Set Body = New NotesRichTextItem(docMail,"Body")
                        
                              REM Set the list of people for the email
                        
                        sendTo = send1 + ", " + send2 + ", " + send3

                        REM List of errors
                        str3 = Str(errorlist)
                        Call Body.AppendText( str1 & docCI.Licensee_Name(0))
                        Call Body.AddNewline(1)
                        Call Body.AppendText("Errors:" & str3)
                        Call Body.AddNewline(1)

                        Call docMail.Send(True, sendTo)
                  End If




0
BeastDan
Asked:
BeastDan
1 Solution
 
BarryTiceCommented:
First of all, it's conceivable that by the time you get to where you're trying to send mail, errorlist is empty.

The code you have sets the errorlist NotesItem under one of these two conditions:
If PRhasOCOGMark = "Y" And FoundOCOG = "N"
If PRhasNGBMark = "Y" And FoundNGB = "N"

If neither of these condition pairs is true, you never set a NotesItem into the errorlist variable.

Secondly, instead of:
str3 = Str(errorlist)

use
str3 = errorlist.Text

The Text property of NotesItem returns the complete text in the item, whether it be a single item or a list (array).

Hope this helps.

-- b.r.t.
0
 
Sjef BosmanGroupware ConsultantCommented:
Some more remarks:
- I hope you save docPR when the mail is sent
- I wouldn't use errorlist.Text, for it just collapses all text; maybe this would be better
    str3= Join(errorlist.Values, ", ")
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now