Sunday, June 03, 2007

Prohibit users to trigger agents from web

When developing agents, it's easy to forget that every agent can be triggered from web with agentname?OpenAgent URL. Such agent invocation can cause unpredictable results.
To avoid this, developer has these 2 options:
1) Hide agent from web using property "hide design element from: Web browsers"
2) Programmatically find out if the agent is triggered from web and exit

Sub Initialize
ev=Evaluate("@ClientType")
If ev(0)="Web" Then Exit Sub 'Do not run agent if triggered from web
'here goes the rest of the code
'which will be executed in Notes client but not on web
End Sub