Domino Code Fragment

Code Name*
AgentContext class
Date*
04/28/2024
Source (or email address if you prefer)*
Rlatulippe@romac.com
IP address:.18.218.184.214
Description*
This example gets the context for the current agent, then gets the agent itself and prints the agent name and comment.
Type*
Java
Categories*
(Misc)
Implementation:
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
import lotus.notes.*;


public class agentcontextagent extends AgentBase
{
 public void NotesMain()
   {
   try
     {
       Session s = getSession();
       AgentContext ac = s.getAgentContext();
       Agent agent = ac.getCurrentAgent();
       String name = agent.getName();
       String comment = agent.getComment();
       if (comment == null) comment = "No comment";
       System.out.println
       ("Current Agent: \"" + name + "\"");
       System.out.println
       ("Comment: \"" + comment + "\"");
     }
   catch (Exception e)
     {
       e.printStackTrace();
     }
   }
}