Re: Creating and Displaying new notes document from another database

I have a mail database and I will like to take some details and assigned it to a new document from another database.

Upon clicking that agent, a new document from another database will be opened and the fields will be populated with the fields from the mail database.

Fields needed are:
- Channel (by default set to "Email")
- Source (by default as "Public")
- email address (Sender of the email)
- Email subject (Subject of the email)
- Date and Time Received (Date and Time the email is received.)

The new document will be populated with the above value. The user will then fill up the rest of the details and then click on the save button to generate the case id.

Can I include the doc link of the email to the newDoc? Can I search and open an document from otherDB based on the subject title? E.g. if subject has case id of XXXX, the agent will search and open document with case id XXXX. Thanks!

1) Yes, you can, but if the mail is in your database, then the doclink would be to your database, so the intented reader must have Read access to your mail database.
2) Yes, but it's better to store a key, e.g. a keyfield with a name or the document's universal id. They you either have the possibilitiy to open a view and use the keyfield as key, or search directly for the universal id. A link with a universal id will get broken when a document is copied and pasted, whereafter the original is deleted.

0

irene79Author Commented: 2005-05-09

the email is a generic email account shared by a few users, so they should have no problem accessing that mail in the mail database.

Just build a view in otherDB sorted by CaseID and use view.GetdocumentByKey($caseID). Are you able to assign CaseID when these are created in otherDB, or would it just be embedded in the subject line? If it's a standard subject line, you could extract and assign them automatically when the case is created from the email.

What is your specific situation (details/examples, please)?

0

irene79Author Commented: 2005-05-18

Case id is already created when the doc is saved. Right now, I need to get the case ID out of the subject field and open the document with that case id.

e.g. subject is "My case no. is FB20050519-1 for followup action"

Upon clicking of the agent, i should be able to extract FB20050519-1 and open this document from another database. How to derive FB20050519-1 .. Based on the "FB20" and a space, i will determine what is the case id. and open this document.

Wouldn't it have been a lot easier to have added a CaseID field? It might even be better to correct your database design immediately, by adding the CaseID-field and running an agent that will generate the CaseID-field in existing document, extracting them from the Subject-field. You will absolutely regret it later if you don't correct it now.

How to extract the case-id? That depends. Is the structure of Subject always the same, does it always begin with "My case no. is" and end with " for followup action"? Then its easy:
cid:= @Left(@Right(subject; "My case no. is "); " for followup action")

0

irene79Author Commented: 2005-06-02

If i assign the case id when they create the document and they dun save the document, i will have missing numbers because the numbers assigned wasn't used.

There is no standard for subject. It can start and end with anything. As long as it consist of a case id in the subject, the code should be able to extract the id and open the document in edit mode.

I have already written codes to extract the case id, but im not sure how to open the document in the other database (OtherDB) in edit mode.

Set thisDoc = ws.CurrentDocument.Document
Set otherDB = New NotesDatabase("Server", "Test.nsf")

>If i assign the case id when they create the document and they dun save the document,
> i will have missing numbers because the numbers assigned wasn't used.
Then assign a case number during the QuerySave, for it is executed just before the document is saved.

> ... but im not sure how to open the document in the other database (OtherDB) in edit mode
Various posts above describe how to do that. See html:Q_21410504.html#13966408 in this question.

0

irene79Author Commented: 2005-06-02

yes, the case id is created when the user click on the Save button.

The various post is creating a document in the other database. How about opening the document from the other database?

> yes, the case id is created when the user click on the Save button
That's not exactly what I meant. If you have code in the Save-button on the screen, and then you call save, the user can still cancel the save. That's why you need to put the generation of the case-id in the QuerySave script, because that cannot (or is very hard to) be interrupted.

As I said, I dislike the FieldSetText calls. I prefer to work with the doc (not uidoc), that's why I always try to prepare the doc before I call EditDocument. In this case:
Call newDoc.ReplaceItemValue("Contri_Name", "testing")
Place it BEFORE the call to EditDocument.