Examples: Fields property

This agent prints the names of all the fields in the form specified as the agent comment.

import lotus.domino.*;
import java.util.Vector;
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());
      Vector fields = form.getFields();
      if (fields.size() != 0) {
        System.out.println
        ("Fields for " + agent.getComment());
        for (int j=0; j<fields.size(); j++)
          System.out.println
          ("  " + fields.elementAt(j)); }
      else
        System.out.println
        ("No fields for " + agent.getComment());
    } catch(Exception e) {
      e.printStackTrace();
    }
  }
}