Run agent from a Web page

This tip provides one way to run an agent from a Web page and access field values from the backend doc behind every page.

If you want to run an agent from a Web page and access field values from the backend document behind the page,...

one way is to have "Computed for display" field for the backend document fields you need. But, if you just run an agent from a link on the Web page, (as in B. below), it won't pick them up. Using ToolsRunMacro (or probably RunAgent if you have R6) will access values from the Web page.

Part (a) in the code presents a link either to create a calendar database or to link to it if it is already there. The fragment of LotusScript from the "CreateCalendar" agent works out what to call the database and which directory to put it in from fields on the Web page. The fields can be hidden if necessary.
In the code, "libcard" and "login" are computed for display fields on the Web page.

a. (CreateCalendar agent reads field values 
from Web page)
 @If( @IsError(@DbColumn("";"":caldb;"E";1));
  @URLOpen( "/"+caldb+"/cal?openview" )

b. (won't pick up field values)
 @If( @IsError(@DbColumn("";"":caldb;"E";1));
  "[<a href="/"+@WebDbName+"/
CreateCalendar">my calendar</a>]";
  "[<a href="/"+caldb+"/cal">my calendar</a>]"

Set s = New NotesSession
Set doc = s.DocumentContext
If doc.libcard(0) = "" Then
 calendarFilePath$ = CalFolder$ & "S/" & 
doc.login(0) & ".nsf"
 calendarFilePath$ = CalFolder$ & Right$
(doc.libcard(0),1) & "/" &
doc.login(0) & ".nsf" End If

Do you have comments on this tip? Let us know.

This was first published in November 2003

Dig Deeper



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:




  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...