This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Apr 24, 2013, 1:57 AM
6 Posts

Cloning Documents

  • Category: Other
  • Platform: Windows
  • Release: 8.5.2
  • Role:
  • Tags:
  • Replies: 6
Is there a way to clone a XPage document the same way it is done in client, without saving it? If so, could you please post the code on how to accomplish this?
Apr 24, 2013, 6:51 AM
110 Posts
Re: Cloning Documents
 How did you achieve this in client?
Apr 24, 2013, 2:43 PM
366 Posts
Re: Cloning Documents
From a View or from the document to be Cloned?


From a view you could add a column to copy the selected document, save it and then open it. 


From a document you would have to close the existing document and then navigate to the newly created document. 
Apr 24, 2013, 11:23 PM
6 Posts
Re: Cloning Documents
Here is how I currently perform this function in client: I use doc.CopyAllItems to retrieve all the values from the form. Clear out certain fields to make the document appear to be a new document. Then, I set the NotesUIDocument to open the cloned document in edit mode and then refresh the NotesUIDocument. The document is not saved to the database unless the user clicks on the submit button.

In reading Paul's response, it appears that I have to save the document first. I was trying to avoid saving the document in the event the user decides not to submit it. I don't want to have cloned documents just sitting in the database without being submitted.
Apr 25, 2013, 4:19 PM
366 Posts
Re: Cloning Documents
 If you do it from the view you don't have to save the document first.  add a column to the view.   make it a link that opens a new xpage based upon the form.  in the onclick event of the view column store the field values from the selected document to session scope variables.


in the beforeRenderResonse event of the XPage that displays the form values set the field components to the values of the saved session scope variables. 


if the use clicks cancel nothing is saved.  if they click save the the document is saved normally 


 
Apr 27, 2013, 2:30 PM
6 Posts
Re: Cloning Documents
Thanks Paul.  I was able to create a link in my view to capture all values into session variables. The problem I am having now is setting radio buttons, drop down values and multiple value fields to the session variables.  Would you know any reason why these fields are not being set on my form?
Apr 30, 2013, 2:21 PM
366 Posts
Re: Cloning Documents
 Not that comes to mind off the top of my head.  Radio Button and Drop down "fields" should store the single value and they should be like any other field.  A multiple choice field is vector or array, but storing it to a scope variable should not be a problem.


You can "print" out your variables to the log or you can use the openNTF debug toolbar to inspect the values of the scoped variables. 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal