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

Copy from custom DB into Mail DB using Copy Into functions

I've created a Customer Tracking application for our marketing group.

One of their requests is to have it interact with their personal calendar and mail.  I've told them that I could probably deliver something similar to Copy Into\New Mail, \New Calendar Entry, \New To Do.

I'm thinking the easiest way would be to copy the entire form into the the Calendar\Mail\To Do entry in their mail file.  

Can anyway offer a way to do this?  Idealy, I'd like to just have all the text copy into the body field of each item with appropriate line breaks, but I'd be excited with just copying the entire form.

1 Solution
You can use forward action button. This will do exactly what u needed copy the content into the body field of the memo.

jk9783Author Commented:
That works for new mail messages, but what about calendar items and to do's?
The forward works in all the documents !
jk9783Author Commented:
No, I think you're misunderstanding my question.  I want to take items from my custom database and place them into the user's mail file.  So, I want them to be able to place a client's contact information from my custom app into a To Do item in their calendar.

When I forward them, it just pops them into a mail message.

Your only option for doing what you want is to use LotusScript to read the field contents of the source document and write to the user's mail database to create documents using the Memo, ToDo or _CalendarEntry forms.  Because this script will be run by the user whose database the document will be created in, there won't be any ACL issues.  The code can be put in a button, or in a form event like QueryClose for the document being exited out of when you want the document creation in the user's mail db to occur.  

Here's a sample of some code.  You would want to copy specific fields not all fields as I've done here. Look in the Lotus Classes documentation for the NotesDocument class

Sub Click(Source As Button)
      Dim session As New NotesSession
      Dim db As NotesDatabase
      Set db = session.CurrentDatabase    
      Dim sourceDocument As NotesDocument
      Dim ws As New notesuiworkspace    
      Dim uidoc As notesuidocument
      Dim CourseInfoDocument As NotesDocument
      Set uidoc = ws.currentdocument  
      Set CourseInfoDocument = uidoc.Document
      ' now build a back end doc for the user to mail to themself or the db Administrator
      Set sourceDocument = db.createDocument
      sourceDocument.form = "A. Create Canada and NEWCRS"
      ' copy all items from the current document into the new document
      Call CourseInfoDocument.CopyAllItems(sourceDocument)
      Call sourceDocument .replaceItemValue("subject", "OA form for course " + CourseInfoDocument.getItemValue("cancode")(0))
      Call sourceDocument .replaceItemValue("principal", "NetLearn to sourceDocument update document")
      Call sourceDocument.send(True, session.username)
      Messagebox ("This document has been mailed to the Mail database for " & Chr$(13) & session.commonusername)
      Call uidoc.close()
End Sub

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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