Copy Document From Db-A to Db-B if field is ?

Hello Expert

I have two database's DB-A and DB-B, DB-A is a mail in database and i let people send in that database. When a new mail has been send to DB-A i want an agent to scan that document that was coming into DB-A and if "SendTo" field is ? then i will send the document to DB-B

Is This possible? , i will raise the points for good answer

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

what do u mean? The sendto field will have the name of the mail-in dbA if its coming to dbA, or do u mean if its sent to multiple recepients?
mummiAuthor Commented:
I have an agent that monitor smpt database, i run agent on each document and if sendto field contains "" then i will copy that document to another database

Hi mummi,

I think you want to monitor the mail routing , if any mail going to some address , then you want to copy the document (mail) to another document. Ok. This is possible. Create an agent which will monitor the smtp box, if new mail arrives , copy to new database. If you want the code , i will give you.

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

mummiAuthor Commented:
Ok. i want the code, and thank you for understanding me

mummiAuthor Commented:
Ok. i accept the code

mummiAuthor Commented:
Hi mummi,

here the code:
Sub Initialize
 Dim session As New NotesSession
 Dim db As NotesDatabase
 Dim protocolDb As New NotesDatabase( "", "projects/p0005/protokol.nsf" )
 Dim collection As NotesDocumentCollection
 Dim doc As NotesDocument
 Dim j As Integer
 Set db = session.CurrentDatabase
 Set collection = db.UnprocessedDocuments
 For j = 1 To collection.Count
  Set doc = collection.GetNthDocument( j )
  If (Instr(1,doc.Request(0),"/projects/p0005/")) Then
   If (Instr(1,doc.Request(0),"/$FILE/")) Or (Instr(1,doc.Request(0),"?OpenDocument")) Or (Instr(1,doc.Request(0),"?OpenForm"))  _
                  Or (Instr(1,doc.Request(0),"?EditDocument"))  Or (Instr(1,doc.Request(0),"?CreateDocument")) Or ((Instr(1,doc.Request(0),"?OpenDatabase")) And Not ((doc.AuthenticatedUser(0) = "-"))) Then
    Call doc.CopyToDatabase(protocolDb )          
   End If
  End If
  Call session.UpdateProcessedDoc( doc )
End Sub

This example runs on my site with following settings:
Run when: If Documents Have Been Created or Modified
Which: Newly modified documents

This code copies at my site from: "domlog.nsf" to "projects/p0005/protokol.nsf" all new documents which have in the URL field the download sign ("/$FILE/") from a special directory.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.