Webquerysave agent does not work
Posted on 2004-08-04
I'll be as much detail as I can. I have two forms.. one is visible only in web. one is visible only in notes. both have same names and same fields.
So if i compose a new document and save it over the web it also stores the values in the notes form. Now I've a button in the notes form which when clicked will save the notes form and runs an agent. This agent runs fine when the the button is clicked in notes.
However, if use the same agent in the webquery save agent for the web form it does not work. What could be wrong with this?
Here is the agent.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim doc2 As NotesDocument
Dim doc3 As NotesDocument
Dim Line1 As String
Dim Line2 As String
Dim Line3 As String
Dim ritem As NotesRichTextItem
Set db = session.CurrentDatabase
Set doc = session.DocumentContext
Set view = db.GetView("PortalAD")
Let AddMANCount = 0
Set doc3 = New NotesDocument(db)
doc3.form = "Memo"
doc3.SendTo = BMmail
doc3.CopyTo = EDImail
doc3.Subject = "Portal Adds & Deletes Request # " & doc.txtFormNumber(0) & " has been Processed successfully."
Line1 = "Portal Adds & Deletes Request # " & doc.txtFormNumber(0) & " submitted by " & doc.Origname(0) & " for CustomerID-ConfigID " & doc.CusconID(0) & " has been successfully processed " & Chr$(10) & Chr$(10)
Line2= "You are receiving this email because you are the Originator of this request. " & Chr$(10)
Line3= "If you are NOT the originator, please report to firstname.lastname@example.org " & Chr$(10) & Chr$(10)
Set rtitem = New notesRichTextItem(doc3,"Body")
Call rtitem.appendText(Line1 & Line2 & Line3)
Call doc3.send ( True )
Let SearchFormula$ = "Form = ""Config"" & " _
& "@Text(Password) = """ & doc.CusconID(0) & """ & " _
& "ConfigStatus = """ & "L" & """ & " _
& "@Isresponsedoc= 0 & "_
& "Version != """ & "2.0" & """ "
Set Collection = db.search( SearchFormula$, Nothing, 0 )
'Print "Searchformula : '" & SearchFormula$ & "'"
If Collection.Count = 0 Then
Set doc2 = Collection.GetFirstDocument
If doc.Typeofaction(0) = "A" Then
If doc.Typeofaction(0) = "D" Then
Dim item1 As NotesItem
Set item1 = doc2.GetFirstItem("MTN")
Forall m In doc.MAN
Let AddMANCount = AddMANCount + 1
Dim result1 As Variant
result1 = Evaluate(|@Unique(MTN)| , doc2)
doc2.MTN = result1
'Print exiting program -- commented
When I use this agent in the webquery save agent, it is sending the email successfully. I've also given a print statement after the Forall statement.
It displayed the print statement in the browser. If I remove the print statement and run it it says form processed over the web. But it is not appending values to the doc2.MTN field.