We help IT Professionals succeed at work.

Lotus Agent called from a HTML http reference hotspot in a document does not seem to pickup DocumentContext

noloco asked
Hi EVERYONE !!! Long time no see - hope you're all well!
I'm generating a statistics-type document based on a db.Search using LotusScript. The script creates a document full of various stats on the search and adds statistics tables to the document by adding HTML to a RichTextField in that target document.
This all works fine. However I'm trying to add extra functionality to the Statistics document by making certain numbers into hotspots that will call another  LotusScript agent when clicked.
The line of code that does this in the Statistic Document generating agent is as follows:

Call rtitem.appendtext("[<td align=""RIGHT"" bgcolor = ""#0031C6"" width=8%><a href=http://*****/*****/*******.nsf/BUILDER+for+LIST+Search+results?OpenAgent"+"><b><font face=Arial size=2 color=""#00E100"">"+Cstr(x)+"</b></font></td>]")

This other agent (called "BUILDER for LIST Search results") needs to read information from the Statistics document from which it is triggered, but it doesn't seem to do so. In the "BUILDER for LIST Search results" agent I am using session.DocumentContext to try to access the values in the triggering Statistics document but it does not appear to be reading any field values at all. The purpose of this agent is to generate another document in the database that shows a HTML generated VIEW-type document of those documents relevant to the hotspot number that is clicked. And for this to happen I need to carry out String handling to access the relevant parts of the Search query which is stored in a field in the originating Statistical document.

I'm assuming this is a restriction in DOMINO R 5.0.2. - if not maybe someone could guess what I may be doing wrong.
If it is a known restriction in R 5.0.2. - could anyone offer me an alternative suggestion as to how I might hotspot values in the Statistical Document so I could generate another "view"-styled document by interpreting other fields on that Statistical document?

I hope ye can follow me - if not - let me know and I'll try to clarify further.
Watch Question

Hello noloco,

first of all: it is allways bad idea to have host names in your LotusScript source code. Make it always server relative by starting with a forward slash and not with protokol identifier.
Second: You can have short names (aliases) for your agents. Name it like this:
BUILDER for LIST Search results | SearchBuilder

Than you can call your agent by his alias: "SearchBuilder"

I would also recomad you to make the the database name variable in LotusScript source code by using database property FilePath.

Also do not doubletrouble your " quotas. Inside a string enclosed in "-chars use ' (single quote) for html quoting.

This all together leads to this example:
Call rtitem.appendtext("[<td align='RIGHT' bgcolor='#0031C6' width='8%'><a href=/" & db.FilePath & "/SearchBuilder?OpenAgent><b><font face=Arial size=2 color='#00E100'>"+Cstr(x)+"</b></font></td>]")

But this still does not answer your question: why does the agents DocumentContext not show any of the fields?
Answer: your href does the agent call from the very beginning, like from the URL box. The agent is not embeded in the form.

Because you produce the html code on your own, it will be difficult to pass the necessary parameters to the new calling agent.
One possibility would be to pass all necessary params after ?OpenAgent action.
Then you can fetch it from DocumentContext.Query_String(0)
This is wath I would recommand you.

There are two other methods calling this new agent with parameters. But they are far more complicated.
One method would be to manipilate the <FORM> tag to compose a new query document with a NotesForm containing this necessary fields and invoking the agent as WebQuerySave agent.
The second (and most unknown method) is to manipulate the <FORM> tag to make a POST action to an agent. Than you need no Notes form and your agent gets all fields into one field named: REQUEST_CONTENT
More details about this last method you can find here in my last "stamp" posting:

Good luck,


Nice one zvonko - thanks for that - worked a peach.
p.s. I know the above code was just a rough up-fornt attempt but thanks for the "clean-up" tips all the same.

Thanks for the feedback <|;-)

...but wath about points :-)


Hey - I thought I had accepted zvonkos answer as an answer - did you get the points zvonko?
I went thru the usual procedure but the status on this hasn't changed...?


Hope this does it. Ta again zvonko!

Thanks for the points <|;-)