Can anyone helpme, this code works fine within the 7.0 client but we have upgraded a couple of clients to 8.5 and the mail notification will not send?
This is the code in question I am not overly familiar with script so bear with me…
Regards
Mark
Sub SendNotification
Print "SendingNotification"
'Instantiate the object variables for the maildoc note that we will create and its Body field
Set maildoc = New NotesDocument(db)
Set rtitem = New NotesRichTextItem(maildoc, "Body")
DueDate = note.DueDate
'If this is the last approver then mail is sent to the requester
'The Recipient variable is used in the Messagebox at the end of this sub, to tell the user who mail was sent to
If LastApprover Then
RequesterName = note.RequesterName
SendTo = RequesterName(0)
Recipient = RequesterName(0)
Select Case Action(0)
Case "Approve"
StatusString = "approved"
tmpFlowStatus = "Approval of your " & WorkflowObject(0) & " is complete. "
Case "Deny"
StatusString = "denied"
tmpFlowStatus = WorkflowObject(0) & " has been denied by " & CurrentUser
Case "Withdraw"
StatusString = "withdrawn"
tmpFlowStatus = "Your " & WorkflowObject(0) &_
" has been withdrawn. You may be able to resubmit it at another time. "
End Select
Subject = "Your " & WorkflowObject(0) & " has been " & StatusString
maildoc.FlowStatus = tmpFlowStatus
Else
'If there are more approvers we need the appropriate expire date because we put in on the message
Select Case RoutingMethod(0)
'If it is Serial - mail gets sent to the NextApprover
Case "Serial"
SendTo = NextApprover
Recipient = NextApprover
'If it is Parallel - mail gets sent to all approvers
Case "Parallel"
SendTo = ApproverList
Recipient = "all Approvers"
End Select
Subject = WorkflowObject(0) & " requires your approval by " & Format(DueDate(NextAppr), "Long Date")
maildoc.DueDate = Format(DueDate(NextAppr), "Long Date")
maildoc.FlowStatus = "Please follow this doclink to the " & WorkflowObject(0) & " and either approve or deny it."
End If
On Error Goto ErrorSending
'Send it, attaching the form if NotificationMethod = “Send”
NotificationMethod = note.NotificationMethod
Select Case NotificationMethod(0)
Case "Send"
note.SendTo = SendTo
note.Subject = Subject
note.save True, True
Call note.Send (True)
Case "Share"
'Put a doclink in the Body field and populate the other fields on the Bookmark mail form
Call rtitem.AppendDocLink(note, "DocLink to " & WorkflowObject(0))
maildoc.InheritedDbTitle = db.Title
maildoc.Form = "Bookmark"
maildoc.SendTo = SendTo
maildoc.Subject = subject
'If the request is being denied we update the Bookmark document field with the name of the object
'plus the Request Date and Request ID
If (StatusString="denied") Then
maildoc.InheritedSubject=WorkflowObject(0)+" Requested On "+Cstr(note.RequestDate(0))
End If
Call maildoc.Send (False)
End Select
'Display a message telling the user that mail has been sent and to whom
Messagebox "Notification has been sent to " & Recipient & ".", 0 + 64, PromptTitle(0)
Exit Sub
ErrorSending:
Messagebox "FYI: " & Recipient & " could not be notified via email at this time.", 0 + 64, PromptTitle(0)
Exit Sub
End Sub