Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to send document in database to multiple persons listed?

Posted on 2004-09-13
9
Medium Priority
?
307 Views
Last Modified: 2013-12-18
I have a form and in this form, there is an editable Readers field - AuthorizedReader with default value - @UserName.
I created a button - MailSend so that when the author create this document, he/she will click on this button to send to all the person listed in the AuthorizedReader field.
My formula for the button works only when 1 username is in this field. If there are multiple users in this AuthorizedReader field, it give me this msg-> Document has been send to authorized readers! and follow by this error -> Unable to send mail, no match found in Name & Address Book(s). But the names listed are correct.

Formula for MailSend button:
Sub Click(Source As Button)
      Dim ws As New NotesUIWorkspace
      Dim uidoc As NotesUIDocument
      Set uidoc=ws.CurrentDocument
      Call uidoc.save
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Dim newDoc As NotesDocument
      Dim curdoc As notesdocument
      Dim rtitem As NotesRichTextItem
      Dim dateTime As New NotesDateTime("")
      Set db = session.CurrentDatabase
      Set curdoc = uidoc.document
      Set newDoc = New NotesDocument( db )
      Set rtitem = New NotesRichTextItem( newDoc, "Body" )
      Call rtitem.AppendText( "New Meeting document added! Please follow this document link to view the meeting details" )
      Call rtitem.AddNewLine( 2 )
      Call rtitem.AppendDocLink( curdoc, db.Title )
      Messagebox ("Document has been send to authorized readers!")
      Call uidoc.Close
      Call newdoc.Send(False,uidoc.FieldGetText("AuthorizedReader"))
      Call ws.ViewRefresh
End Sub

Pls help.
Thank you very much.

0
Comment
Question by:kopibean
  • 4
  • 3
  • 2
9 Comments
 
LVL 19

Accepted Solution

by:
madheeswar earned 200 total points
ID: 12051458
try this:
Sub Click(Source As Button)
     Dim ws As New NotesUIWorkspace
     Dim uidoc As NotesUIDocument
     Set uidoc=ws.CurrentDocument
     Call uidoc.save
     Dim session As New NotesSession
     Dim db As NotesDatabase
     Dim newDoc As NotesDocument
     Dim curdoc As notesdocument
     Dim rtitem As NotesRichTextItem
     Dim dateTime As New NotesDateTime("")
dim item as notesitem
     Set db = session.CurrentDatabase
     Set curdoc = uidoc.document
     Set newDoc = New NotesDocument( db )
set item=curdoc.getfirstitem("AuthorizedReader")
     Set rtitem = New NotesRichTextItem( newDoc, "Body" )
     Call rtitem.AppendText( "New Meeting document added! Please follow this document link to view the meeting details" )
     Call rtitem.AddNewLine( 2 )
     Call rtitem.AppendDocLink( curdoc, db.Title )
dim x as integer
For x=0 to Ubound(item.values)
     Call newdoc.Send(False,item.values(x))
print "Mail Send to: "&cstr(item.values(x))
next
     Messagebox ("Document has been send to authorized readers!")
     Call uidoc.Close

     Call ws.ViewRefresh
End Sub
0
 

Author Comment

by:kopibean
ID: 12051585
The above works!!
I forgot I need to add in the subject ->
newdoc.Subject = "<From XXX DB>" + "[" + uidoc.FieldGetText("category") + "]" + uidoc.FieldGetText("subject")
Where do I place this code at?

Pls advise!
THanks!
0
 
LVL 15

Assisted Solution

by:Bozzie4
Bozzie4 earned 80 total points
ID: 12051664
Actually, you now send separate mails.  You can do the same in 1 memo.

newdoc.SendTo = uidoc.document.AuthorizedReader
' newdoc.CopyTo = uidoc.document.AuthorizedReader ' to put them all in copy or blindcopy , is a good idea.

...

Call newdoc.send( False, curdoc.AuthorizedReader) ' I generally do it double (use sendto field, and put the to's here, because it works better for me)

for subject, use :

newdoc.Subject = "<From " +  uidoc.document.parentdatabase.title + " DB>" + "[" + uidoc.document.category(0) + "]" + uidoc.document.subject(0)

And you may have noticed I don't use curdoc.  I find it better to use uidoc.document throughout your code (in a button like this), because then you are sure the Notes Document object is in sync with the frontend NotesUIDocument.

cheers,

Tom Bosmans
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 19

Expert Comment

by:madheeswar
ID: 12051678
Tom,
what you said is correct. I agree.
If the requirment is something like other perosns name should not be listed, then my approach is the only option. BCC is not an option.

0
 

Author Comment

by:kopibean
ID: 12051740
I place the subject after this line ->

Call newdoc.Send(False,item.values(x))
newdoc.Subject = "<From " +  uidoc.document.parentdatabase.title + " DB>" + "[" + uidoc.document.category(0) + "]" + uidoc.document.subject(0)
Print "Mail Send to: "&Cstr(item.values(x))

but the subject in my inbox show nothing?
Did I place the subject code wrong?

Pls advise.
Thanks!


      
0
 

Author Comment

by:kopibean
ID: 12051746
Opps...I know where to place the subject header....
thanks madheeswar and tom!!
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 12052223
then increase the points & Grade "A" and accept.

-Thanks
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 12053442
Why would bcc not be an option ?  It works great, the only thing you need to do is put a bogus /fake address in the sendto field  !

cheers,

Tom
0
 
LVL 19

Expert Comment

by:madheeswar
ID: 12061491
TOM,
I want to display one name in To field and no names in other fields(CC/BCC).

So, then my approach is correct right. I had this requirement in my previous company.

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Integration Management Part 2
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question