Pass variables to the background web agent through the URL

The code below was used to pass the child's parent document ID to the agent. The agent used the UNID to get a handle on the parent document and extract the attachment.
LotusScript

Insert an "&" to use multiple variables (i.e. ?OpenAgent&var1=Beavis&var2=Butthead&var3=Ren&var4=Stimpy)

EXAMPLE:

CODE ON FORM, BUTTON, ETC...:

parent.top.location.href= "folder1/database.nsf/agentname?OpenAgent&pdoc=" + document.forms[0].ur_ParentDocumentID.value

Agent Code

Sub Initialize

Dim session As New notessession
Dim db As notesdatabase
Set db = session.currentdatabase
Dim doc As notesdocument
Set doc = session.DocumentContext

'Get parentID from address variable
Dim qstring As Variant
qstring = Evaluate("@Rightback( Query_String ; 15)", doc)
Dim ParentID As String
ParentID = qstring(0)

'Get a handle on the parent document
Dim pdoc As NotesDocument
Set pdoc = db.GetDocumentByUNID( ParentID )

Dim URL As String
URL = "/gdc/datacollect.nsf/files/" & pdoc.UniversalID & "/$File/" & pdoc.dr_attachmentname(0) & "?OpenElement"

'Force the browser to download and pass the file URL
Print "Content-Type:application/download"
Print "Content-Disposition:attachment; filename=" & Chr(34) & pdoc.dr_attachmentname(0) & Chr(34)
Print "[" + URL + "]"

End Sub

Posted by fbrefere001 on Monday February 24, 2003