I have a web-enabled form that captures FirstName, LastName and other stuff from a form on a web site. I run a @Command([RunAgent];agent)to email the data to an internet address which works fine with static information coded into the agent. Following is the code I’m trying to alter. How can I capture the FirstName, LastName and TelephoneNumber fields from the web-enabled form into the agent that sends the email?
Sub Initialize
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As notesdocument
Dim maildoc As notesdocument
Set db =session.CurrentDatabase
Set maildoc= New Notesdocument(db)
maildoc.form= "Memo"
maildoc.principal = "CN=Brian Reno/O=Hilltop"
maildoc.sendTo = "6464315980@tmomail.net"
maildoc.Subject="I need to pull Subject from document into this field.. help!"
maildoc.Body = "I need to pull FirstName, LastName and Telephone number, concatenated with spaces into this field... help!"
Call maildoc.Send(True )
End Sub
–ps I’m a newbie to LotusScript so please be gentle with me. thanks.
you need to session.documentcontext to capture the document the user just filled out. Other than that you need to just access the fields from the document.
’ Jeffrey, I’ll give you a hand… so many people have already helped me!’ make sure you pass on your knowlege some day too!
Sub Initialize
' Here's how I usually do it. I start with the "DIM" of the highest level of object
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As notesdocument
Dim maildoc As notesdocument
' Then I set from top down...
Set db =session.CurrentDatabase
' See, you missed Doc... here it is...
Set doc = session.DocumentContext ' This gets the document that called this script.
Set maildoc= New Notesdocument(db)
maildoc.form= "Memo"
maildoc.principal = "CN=Brian Reno/O=Hilltop"
maildoc.sendTo = "6464315980@tmomail.net"
maildoc.Subject= doc.subject(0) ' I need to pull Subject from document into this field.. help!"
maildoc.Body = doc.FirstName(0) + " " + doc.LastName(0) + " " + doc.PhoneNumber(0)
'I need to pull FirstName, LastName and Telephone number, concatenated with spaces into this field... help!"
Call maildoc.Send(True )