createDocument (NotesDatabase - JavaScript)
Creates a document in a database and returns a NotesDocument object that represents the new document.
Defined in
NotesDatabaseSyntax
createDocument() : NotesDocument| Return value | Description |
|---|---|
| NotesDocument | The new document. |
Usage
You must call save if you want the new document to be saved.Examples
This button creates a new document in the current database and appends an item named Subject with the value of a requestScope variable. The requestScope variable is bound to an edit box that the user fills in before clicking the button.var doc = database.createDocument();
doc.appendItemValue("Subject", requestScope.subject);
doc.save()
This button creates a document in the current
database and assigns values.
var doc:NotesDocument = database.createDocument();
doc.appendItemValue("Form", "main");
doc.appendItemValue("subject", "Test Document");
doc.appendItemValue("categories", "Test Documents");
var rti:NotesRichTextItem = doc.createRichTextItem("Body");
rti.appendText("This is the first sentence of text.");
rti.appendText(" This is the second sentence of text.");
if (doc.save()) {
requestScope.status = "Document has been saved"
} else {
requestScope.status = "Unable to save document"
}
Language cross-reference
CreateDocument method in LotusScript® NotesDatabase classcreateDocument method in Java™ Database class
Compose @command of formula language