copyItem (NotesDocument - JavaScript)

Copies an item into the current document and optionally assigns the copied item a new name.

Defined in

NotesDocument

Syntax

copyItem(item:NotesItem) : NotesItem

copyItem(item:NotesItem, newname:string) : NotesItem

Parameter Description
item The item, usually from another document, that you want to copy. Cannot be null.
newname The name to assign to the copied item. Specify null to retain the existing name of the item.
Return value Description
NotesItem A copy of the specified item, identical except for its new name.

Examples

This button creates a new document copying into it an item from a profile document.
var doc:NotesDocument = database.createDocument();
var disclaimer:NotesDocument = database.getProfileDocument("Disclaimer", null);
var text:NotesItem = disclaimer.getFirstItem("DisclaimerText");
doc.appendItemValue("Form", "main");
doc.appendItemValue("Subject", requestScope.query);
doc.appendItemValue("Quantity", requestScope.quantity);
var foo = doc.copyItem(text);
doc.save();
requestScope.status = "Document created";