-2

I have two documents; document1 allows read/write, but document2 is readonly.

var document1:NotesView = database.getView("viewDoc1");
var document2:NotesView = database.getView("viewDoc2");
//var copiedDoc:NotesDocument=document2.CopyToDatabase(document1);
docEv:NotesDocument = document1.getDocumentByKey("userName");
if(docEv!=""){...}else{...};

beforePageLoad

Before page is rendered, I want to be able copy all data in the readonly document and save it into the read/write document and also check if documents already exist in the read/write, in which case don't copy. Your help will be appreciated.

  • 1
    Please advise what code you have tried and where it fails. If you're looking for someone to write the code for you, StackOverflow is not the appropriate place to ask. Business partners and contractors sell those services. – Paul Stephen Withers Jul 07 '17 at 15:39

1 Answers1

1

This line of your code makes no sense:

var copiedDoc:NotesDocument=document2.CopyToDatabase(document1)

First of all, you said that you want to copy document2 into document1, but you appear to be trying to copy it into a new, third NotesDocument called copiedDoc.

But more importantly, you're passing document1 as the argument into the CopyToDatabase method, but that method takes a NotesDatbase argument, not a NotesDocument argument!

You may want to look at the CopyAllItems method instead.

Richard Schwartz
  • 14,463
  • 2
  • 23
  • 41