Examples: IsNewNote property
This agent shows the effect of IsNewNote before and after saving a newly created document.
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)
Database db = agentContext.getCurrentDatabase();
Document doc = db.createDocument();
doc.appendItemValue("Form", "Main Topic");
doc.appendItemValue("Subject", "New document 1");
doc.appendItemValue("Categories", "New documents");
isitnew(doc);
System.out.println("... saving ...");
doc.save();
isitnew(doc);
} catch(Exception e) {
e.printStackTrace();
}
}
public void isitnew(Document doc) {
try {
if (doc.isNewNote())
System.out.println("\"" +
doc.getItemValueString("Subject") +
"\" has not been saved yet");
else
System.out.println("\"" +
doc.getItemValueString("Subject") +
"\" has been saved");
} catch(Exception e) {
e.printStackTrace();
}
}
}