I’m having some problems creating a document with an agent, and I think that it might just be something small I’m overlooking.
I’ve got
Database db = agentContext.getCurrentDatabase();
Document doc = db.createDocument();
doc.appendItemValue("Form", "MainTopic");
doc.appendItemValue("Subject","CreateRichTextItem");
// Create rich text item and append text
RichTextItem rti = doc.createRichTextItem("Body");
rti.appendText("First paragraph.");
rti.addNewLine(1);
rti.appendText("Second paragraph.");
doc.save(true, true);
from the help file, so it should be right. The document shows up in the view, but it isn’t being created correctly. At first, it was giving me an error: “Cannot locate form : MainTopic”, then “Cannot locate Default Form”. So I created a blank form named MainTopic and saved it. I no longer get the error messages when I open the newly created documents, but they are blank.
Does anyone know what I’m doing wrong?