p>Using Evaluate(@UserRoles) is a good way to capture user roles in LotusScript. The only problem is that if you use it for a web agent, it captures the user roles of the PERSON/ENTITY WHO LAST SAVED THE AGENT rather than the user roles of the web user who happens to trigger the agent. That's because, by default, agents run with the privledges of whoever saved the agent.
Consider the following code:
userRoles = Evaluate("@UserRoles") Forall role In userRoles If Ucase(role) = "[ADMIN]" Then admin = "Yes" Exit Forall End If End Forall
By default, this will get the user roles of the person who last saved the agent. To make it so that it gets the user roles of the web user who triggered the agent, do the following:
- In Designer, goto Agents.
- Right click on the agent for which you have the Evaluate(@UserRoles) code.
- Click on Agent Properties.
- Click on the Design tab (3rd tab).
- Check the box labelled "Run Agent as Web user"
The agent should then perform as desired.