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

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

Regards
Mummi
0
mummi
Asked:
mummi
1 Solution
 
ghassan99Commented:
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?
0
 
mummiAuthor Commented:
I have an agent that monitor smpt database, i run agent on each document and if sendto field contains "pop@pop.com" then i will copy that document to another database

ok?
0
 
AntonysinghCommented:
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.

Regards,
Antony.
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

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

Mummi
0
 
mummiAuthor Commented:
Ok. i accept the code

mummi
0
 
mummiAuthor Commented:
Hello!!!
0
 
stampCommented:
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 )
 Next
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.

Regards,
stamp
0

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