Examples: IsProtectUsers property

This agent toggles protection for $FormUsers in the form specified as the agent comment.

import lotus.domino.*;
public class JavaAgent extends AgentBase {
  public void NotesMain() {
    try {
      Session session = getSession();
      AgentContext agentContext = session.getAgentContext();
      // (Your code goes here) 
      Agent agent = agentContext.getCurrentAgent();
      Database db = agentContext.getCurrentDatabase();
      Form form = db.getForm(agent.getComment());
      if (form.isProtectUsers()) {
        form.setProtectUsers(false);
        System.out.println
        ("Protect users cleared for " + form.getName()); }
      else {
        form.setProtectUsers(true);
        System.out.println
        ("Protect users set for " + form.getName()); }
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}