copyAllItems (NotesDocument - JavaScript)

Copies all items in the current document into the destination document.

Defined in

NotesDocument

Syntax

copyAllItems(doc:NotesDocument, replace:boolean) : void
Parameter Description
doc The destination document.
replace If true, the items in the destination document are replaced. If false, the items in the destination document are appended.

Usage

The item names are unchanged.

If you are not copying to a newly created document, you should probably specify true for the second parameter. See appendItemValue for a note about appending items to existing documents.

Examples

This button creates a document and a copy.
var doc = database.createDocument();
doc.appendItemValue("Form", "main");
doc.appendItemValue("Subject", requestScope.query);
doc.appendItemValue("Quantity", requestScope.quantity);
doc.save();
var copy = database.createDocument();
doc.copyAllItems(copy, false);
copy.replaceItemValue("subject", "Copy of " + copy.getItemValueString("subject"));
copy.save();
requestScope.status = "Document and copy created"