Best way to have reply emails entered into a Lotus Notes form document

ajl7519 used Ask the Experts™

I have a ticketing database that I would like to setup so I can email from the ticket and when the user responds to have that information go directly into the ticket. Basically, I would to email directly from the ticket (I am assuming I can create a email form tied to the ticket) and to have thread documented into the ticket.

What would be the best way to accomplish this?

Thanks in advance..
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Sjef BosmanGroupware Consultant

Sending mail is the easiest part, it's no big deal at all.

Receiving mail is a bit more difficult. What's important is that you understand the concepts, and then everything will automatically fall into its place:
- Notes/Domino has the concept of a Mail-in database: any database can be given a mail address
- mails received directly in the database always trigger the necessary agents (either Before or After mail arrived)
- the form used is always the Memo form (it's not a real form, it's just the name in the Form-field)
- the agent can convert the message to a more appropriate document in the database
- the agent can also try to figure out who the sender was, what the original message was (if any), so where the message should be attached
- an example could be the ticket number in the Subject field

Can you translate your problem into the above?
Additional thoughts:

I would make the responses into response documents to the original ticket.  You can then make them visisble using an embedded view or other means.

You can glean useful tips from the discussion template included with Notes, and don't forget OpenNTF:  It has tons of useful stuff, including a Help application which might save you a lot of work.


Well here is what I have for the Submit button. It will generate an email which includes the DocNumber, which is the ticket number. I also have similar emails go out when the ticket is assigned and then closed. The ticket number is generated by a hidden view and is sequential for each ticket. I have the messages being sent from another mail in database.

So what you are saying sjef_bosman is I can have an agent run based on the ticket number as it will be unique? What I would like to do is add an action button that would open up a new email form (I am assuming this could be a response document) for that would go out to the user. From there they would reply and I would need to tie that response document into the ticket?

Sub Click(Source As Button)
	Dim continue As Variant
	Dim workspace As New NotesUIWorkspace
	Dim session As New NotesSession
	Dim db As notesdatabase
	Dim maildoc As notesdocument
	Dim Body As NotesRichTextItem
	Dim uidoc As NotesUIDocument
	Dim doc As notesdocument
	Set uidoc = workspace.CurrentDocument
	Set doc=uidoc.document
	Dim valFields() As String
	Dim valcheck As String
	Redim valFields(6)
	valFields(0) =  "Laptop/Desktop/Blackberry"
	valFields(1) =  "Printer/Scanner/Copier/Fax"
	valFields(2) =  "Lotus Notes/Met Applications/Other Software"
	valFields(3) =  "VPN/Wireless/Connectivity"
	valFields(4) =  "Phone"
	valFields(5) =  "Move"
	valFields(6) =  "Generic Request"
	' loop through each valFields
	Forall xval In valFields
		valcheck = uidoc.FieldGetText("RequestType")
		If valcheck=  xval Then
			Goto Details
			continue = False
			Exit Sub
			If ( uidoc .FieldGetText( "Details" ) = "" ) Then
				Messagebox( "You must enter details of your request." )
				Call uidoc.GotoField( "Details" )
				continue = False
				Exit Sub
			End If
		End If
	End Forall
	Call uidoc.Save
     'Send mails:
	Set db=session.currentdatabase
	Set maildoc = New NotesDocument( db )
	maildoc.Form = "Memo"
	maildoc.From = doc.Requester(0)
	maildoc.SentBy = doc.Requester(0)
	maildoc.SendTo = "BFGSERVICEDESK"
	maildoc.Subject = "Request "+doc.DocNumber(0)+" submitted."              
	Set Body=New NotesRichTextItem(maildoc,"Body")
	message=  "New service request for "+doc.UserCN(0)
	Call Body.AppendText(message)
	Call Body.AddNewLine(1)
	message1= "Priority: "+doc.Priority(0)
	Call Body.AppendText(message1)
	Call Body.AddNewLine(1)
	message2= "Details: "+doc.Details(0)
	Call Body.AppendText(message2)
	Call Body.AddNewLine(2)
	message3="Please click this link to view this request=========>>"
	Call Body.AppendText(message3)
	Call Body.AppendDocLink(doc,"Please click this link to view this request")
	Call maildoc.Send( False) 
	Dim RequestSubmitted As String
	RequestSubmitted = "Your request has been submitted"
	Messagebox RequestSubmitted , MB_OK + MB_ICONINFORMATION, "Submitted"
	Call uidoc.Save
	Call uidoc.Close
End Sub

Open in new window

Learn Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.


Also, I see what your saying about the embedded view. I would create the view for the response documents and embed into the ticket. I would then need a way to have view to show only the related documents and I suppose I can have script or formula do that.
the embedded view categorizes on the parent id.  in embeded view set show single category using DocumentUNID (==parentID)
Sjef BosmanGroupware Consultant

I wouldn't use the UNID for that purpose, but the DocNumber, assuming it is unique for every ticket and can have multiple responses. An appropriate view with DocNumber as first column (sorted) will allow you to find your ticket document easily. Instead of generating a DocuNumber based on a view, you could use a code generated by @Unique (see the Help db).

> I have the messages being sent from another mail in database.
That puzzles me. Mails sent from a mail-in database? Am I being picky or was my explanation not clear enough? It is a mail-IN database, meaning that mails can be received by the database. Any database can send mails, there's nothing special about that. To receive mails in a database, you need to create a Mail-In Database document in the server's Address Book.


Well, the separate mail-in database was in place before and I was told to continue using. It's basically just a mailbox that handled the tickets. Also, it was requested that I have sequential numbers fro the ticket number (DocNumber).

Sjef BosmanGroupware Consultant

Ok. So you could set the ticket database to receive mails. Of course you have to be prepared to get junk mail in there as well...
Sequential numbers: brr a world of pain. @Unique is actually a pretty good idea.


I wanted to use @Unique, but my boss wanted them sequential. I actually got a tip here how to do that. It works pretty well. I haven't had a problem as of yet.

Yes, I could set the ticketing database as mail-in.

Would it be possible to use it the existing way however? Let's say I create a mail form as a response document sent from the Mail-in database. I can tied that response into the view and filter by DocNumber. Would that work?
Sjef BosmanGroupware Consultant

You have an agent that creates a response in your ticket database when a reply comes in? That would work, yes.

If it were my boss I'd generate those sequential numbers, just for him, but anywhere else I'd use an @Unique id, guaranteed to work even when replicating databases to other servers or clients. The sequential number would then just be that: a number, meaningless.


I think finally understand how to get it to work, but only problem I am having is getting the response document generated from the main document to pick up the fields from the main document. Do you need specific code to link the child document to parent document to accomplish this? Is there where I would use the @Unique to link the documents via a view lookup?

Thanks, I appreciated your help (patience) with Lotus. I basically am the only IT person for like 500 people (and I do absolutely everything from phones to computers) and I only have a hour or so a day to work on Lotus development.
Groupware Consultant
One hour per day?? As a Jack-of-all-trades, man, you really rock! I've been doing this stuff for over 13 years now (more or less), and I usually need the full 8+ hours per day to make Notes work for me. And you do it in one hour? I'd ask for a huge pay raise!

> only problem I am having is getting the response document generated from the main document...
and if that's your ONLY problem... whew!

> Do you need specific code to link the child document to parent document to accomplish this?
Yes. You first need to know which parent document, then you assemble the response, you copy over the values you need from parent to child, and finally you use MakeResponse to attach the repsonse to the parent. There are two ways to copy data from one document to the other:
- using childdoc.replaceItemValue("field", parentdoc.getItemValue("field"))
- fielditem.CopyItemToDocument(destdoc)

But seriously, if you really have only one hour per day, ask a 3rd party Notes developer to do the developments for you.


I got it working. Thanks for you help.
Sjef BosmanGroupware Consultant

I'm truly impressed....


This code picks up all the fields when I used the create mail action. Do you see any problems using it?

Sub Click(Source As Button)
	Dim ws As New notesuiworkspace
	Dim uidoc As notesuidocument
	Dim session As New notessession
	Dim db As notesdatabase
	Dim pdoc As notesdocument
	Dim cdoc As notesdocument
	Set uidoc = ws.currentdocument
	Set pdoc = uidoc.document
	Set db = session.currentDatabase
	Set cdoc = db.createDocument
	cdoc.Form = "Mail" 
	cdoc.MStatus = pdoc.StatusChange(0)
	cdoc.MDocNumber = pdoc.DocNumber(0)
	cdoc.SendTo= pdoc.Requester(0)
	Call cdoc.makeResponse(pdoc)
	Set uidoc = ws.EditDocument(True, cdoc)
End Sub

Open in new window

Sjef BosmanGroupware Consultant

Looks good to me but... for this you don't need code at all, it can be done using standard Notes features:
1/ Define the form type as a Response form (1st tab, 3rd line)
2/ Enable "Formulas inherit values from selected document" on the 2nd tab in the Form Properties
That's why we love Notes!  All the built-ins that save us time!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial