In your agent use this code:
Dim s As New notessession
Dim db As notesdatabase
Set db = s.currentdatabase
Dim doc As notesdocument
Set doc = s.documentcontext
qs=doc.Query_String_Decoded(0)
unid=getvalfromqs(qs,"unid")
In the Initialise or options area of your agent paste this:
Function getvalfromqs(Byval qs As String, Byval fld As String) As String
'this function gets the value of a field from a string
'in the string the format shoul dbe ...&FIELDNAME=jssdjfhsdj
'the nd of the value is delimited by end of string or another &
On Error Goto errhdlr
a=Instr(qs,"&" & fld & "=")
If a=0 Then
getvalfromqs="not found in string"
Exit Function
End If
b = Instr(a+2+Len(fld), qs,"&")
If b=0 Then b=900 ' if end of string then return rest
getvalfromqs=Mid$(qs, a+2+Len(fld), b-(a+2+Len(fld)) )
Exit Function
errhdlr:
On Error Resume Next
Print "Error: getvalfrom qs: " & Error$ & " " & Err & " erl:" & Erl & "<br>"
getvalfromqs="Error: getvalfrom qs: " & Error$ & " " & Err & " erl:" & Erl
Exit Function
End Function
You can use Query_String_Decode or Query_string .
If you are using @formula with servers after R6 you can use the inbuilt function: @UrlQueryString instead:
for example:
http://www.adfos.com/af.nsf?Opendatabase&review=theBest&Category=LotusNotes
@URLQueryString would return an array of
Opendatabase
review=theBest
Category=LotusNotes
@OurlQueryString("Category")
would return
LotusNotes
For completeness Notes 4 developers would use:
@middle(Query_String;"&Category=";"&")