Copy item to a new document

Hi,

My task is to create a view action button that executes a script on the selected documents in a view.

When documents are selected and the view button is clicked, it should create a new document (that will display in another view). This new document should also display anyone of the items (say a name field) from the already existing document.

So far i have only been able to get a handle to the selected documents in the first view, and get a handle to the name field. How can i proceed from here?

Subject: Copy item to a new document

You can use the UnprocessedDocuments property of the NotesDatabase to get a handle to the DocumentCollection of selected documents. Iterate through this collection using GetFirstDocument and GetNextDocument.

Each document you process, you can copy its field values to your new document using something like:

newDoc.ReplaceItemValue “NewFieldName”, existingDoc.GetItemValue(“ExistingFieldName”)

Set the Form field on the newDoc so that it appears in another view (typically, this is the first level of filtering in views although sometimes other criteria are used as well)

If you are not familiar with the properties and objects I mentioned, Designer Help should be able to explain it and give you some sample code to follow.