Tip

Run agent from a Web 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));
  @Command([ToolsRunMacro];"CreateCalendar");
  @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"
Else
 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

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

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:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.