Skip to main content
 
developerWorks
AIX and UNIX
Information Mgmt
Lotus
New to Lotus
Products
How to buy
Downloads
Live demos
Technical library
Training
Support
Forums & community
Events
Rational
Tivoli
WebSphere
Java™ technology
Linux
Open source
SOA and Web services
Web development
XML
My developerWorks
About dW
Submit content
Feedback



developerWorks  >  Lotus  >  Forums & community  >  Notes/Domino 6 and 7 Forum

Notes/Domino 6 and 7 Forum

developerWorks

  

Sign in to participate PreviousPrevious NextNext


Sue Z Sunshine 29.Nov.16 11:31 AM a Web browser
Notes Client All Releases All Platforms


I have a form with a "Save & Mail" action with the code below. Users are receiving the "Error 4295 on line 49 in function SENDMAIL: Unable to send mail, multiple matches found in Name & Address Book(s)

I am looking to see if someone can help revise the code?

Action:
If ValidateTaskFields( uidoc , doc.Type(0), doc.GetFirstItem("Assignee") ) = True Then
'we can open the mail dialog and send the mail
Call SendMail(uidoc, inputtxt, SaveAndMailRecipients)
'stop here if user cancelled or entered no names in the SendMail routine
If SaveAndMailRecipients = "Cancelled" Then Exit Sub
'otherwise, pass the "sent to" line to QuerySave using the SendMailOutput field
Call uidoc.FieldSetText("SendMailOutput", SaveAndMailRecipients)
Call uidoc.Refresh
Call uidoc.Save

Script:
Option Public
Option Declare
Use "OpenLogFunctions"
Use "LS.utilities.BE.6.Extended.Database"
Sub Initialize
'Save & Mail. Send email notification with doclink to designated individuals.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim newDoc As NotesDocument ' the mail message
Dim rtitem As NotesRichTextItem
Dim doc As NotesDocument ' the current document to which the link points
Dim recipients( 1 To 3 ) As String
Dim SaveAndMailRecipients As String
Dim fname As String
Dim label As String
Dim bodytext As String
Dim picklist As Variant
Dim continue As Variant
Dim inputtxt As String
Dim X As Variant
Dim TypeTask As String
Dim itemInput As NotesItem
Dim itemAssignee As NotesItem
Dim user As String
Dim whstring As String
Dim dateTime As New NotesDateTime( "" )

Set db = session.CurrentDatabase
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document

Set itemInput = doc.GetFirstItem( "Input" )
Call uidoc.Refresh
Call uidoc.Save
user = session.CommonUserName
Call dateTime.SetNow

TypeTask = uidoc.FieldGetText("Type")
Set itemAssignee = doc.GetFirstItem( "Assignee" )
If ValidateTaskFields(uidoc, TypeTask, itemAssignee ) = False Then
continue = False
Exit Sub ' we don't want to proceed further if field validation fails
Else ' proceed with mail send dialog
If workspace.DialogBox("DialogSaveAndMail", True, True, False, False, False, False, "Save & Mail to...", , True) Then

If ( itemInput.text <> "" ) Then
doc.WorkHistoryText = dateTime.LSLocalTime & " -- " & user & SaveAndMailRecipients & Chr(13) & Chr(10) & itemInput.text
doc.InputHistory = doc.InputHistory(0) & Chr(13) & Chr(10) & doc.WorkHistoryText(0) & Chr(13) & Chr(10) & "_____________________________________" & Chr(13) & Chr(10)
doc.Input = ""
SaveAndMailRecipients = ""
Else
If SaveAndMailRecipients = "" Then
doc.InputHistory = doc.InputHistory(0)
Else
whstring = dateTime.LSLocalTime & " -- " & user & SaveAndMailRecipients
doc.InputHistory = doc.InputHistory(0) & Chr(13) & Chr(10) & whstring & Chr(13) & Chr(10) & "_____________________________________" & Chr(13) & Chr(10)
doc.Input = ""
SaveAndMailRecipients = ""
End If
End If

Set newDoc = New NotesDocument( db )
Set rtitem = New NotesRichTextItem( newDoc, "Body" )

label = db.Title & ": " & doc.Type( 0 ) & " # " & doc.PMISTask( 0 )
newDoc.SendTo = doc.SaveAndMailTo
newDoc.Subject = label & " (" & Left$(doc.Description(0), 100) & "... )"

bodytext = label 'could include more info from Task doc here if we wanted, someday

Call rtitem.AppendText( label & " --> ")
Call rtitem.AppendDocLink( doc, label )

'capture who sent to and add to Work History in QuerySave
SaveAndMailRecipients = " (sent to: " & Implode(doc.SaveAndMailTo, ", ") & ")"

Call newDoc.Send( False )
'If user has [HelpDesk] role, don't show msgbox
X = Evaluate( | @IsMember("[HelpDesk]" ; @UserRoles) |, doc )
If X(0) <> 1 Then
Msgbox "Message Sent to: " & Implode(doc.SaveAndMailTo, ", ") & ".", 64, "Save & Mail"
End If
doc.SaveAndMailToChecked = "" 'from dialog box
doc.SaveAndMailToAnyone = "" 'from dialog box
Call LogEvent("Message sent: " + label, SEVERITY_LOW, Nothing)
Call doc.Save(True,True,True)

'If user has [TaskTimeLog] role, open a new Time Log document
X = Evaluate( | @IsMember("[TaskTimeLog]" ; @UserRoles) |, doc )
If X(0) = 1 Then
If ValidateForTimeLog(uidoc) Then
Call NewTimeLog(uidoc, itemInput.text)
End If
End If

Call uidoc.Close
End If
End If
End Sub

Thanks in advance!!






Save & Mail / Ambiguous lookup issu... (Sue Z Sunshine 29.Nov.16)
. . RE: Save & Mail / Ambiguous lookup ... (Barry Shapiro 29.Nov.16)
. . . . RE: Save & Mail / Ambiguous lookup ... (Sue Z Sunshine 30.Nov.16)
. . . . . . RE: Save & Mail / Ambiguous lookup ... (Barry Shapiro 30.Nov.16)





  Document options
Print this pagePrint this page

 Search this forum

  Forum views and search
Date (threaded)
Date (flat)
With excerpt
Author
Category
Platform
Release
Advanced search

 Sign In or Register
Sign in
Forgot your password?
Forgot your user name?
Create new registration

 RSS feedsRSS
All forum posts RSS
All main topics RSS
More Lotus RSS feeds

Resources

 Resources
Forum use and etiquette
Native Notes Access
Web site Feedback

Lotus Support

 Lotus Support
IBM Support Portal - Lotus software
Lotus Support documents
Lotus support by product
Lotus support downloads
Lotus support RSS feeds

Wikis

 Wikis
IBM Composite Applications
IBM Mashup Center
IBM Connections
IBM Connections Cloud Developers
IBM Docs
IBM Forms
IBM Mobile Connect
IBM Sametime
IBM SmartCloud for Social Business
IBM Web Experience Factory
Lotus Domino
Lotus Domino Designer
Lotus Expeditor
Lotus Foundations
Lotus iNotes
Lotus Instructor Community Courseware
Lotus Notes
Lotus Notes & Domino Application Development
Lotus Notes Traveler
Lotus Protector
Lotus Quickr
Lotus Symphony
IBM Web Content Manager
WebSphere Portal

Lotus Forums


 Lotus Forums
Notes/Domino 9.0
Notes/Domino 8.5 + Traveler
Notes/Domino XPages development forum
Notes/Domino 8
Notes/Domino 6 and 7
IBM Connections
IBM Mobile Connect
IBM Sametime
IBM SmartCloud Notes
Lotus Enterprise Integration
Lotus Protector
Lotus Quickr
Lotus SmartSuite