1
votes

i am new to xpages, but i want to try to create a response document for a main document which is the order document. there is a product document which display the view of all product in the database and with a checkbox, both document are on one page. using the below code on the onclick event if the checkbox

var colName = view1Collection.getColumnValue("Name");
var prodNameScope = sessionScope.get("scopeProdName");
var docIdScope = sessionScope.get("scopeDocID");

var selDocID = view1Collection.getUniversalID();

 if(docIdScope .contains(selDocID )) {
    prodNameScope .remove(colName );
    docIdScope .remove(selDocID );
    } else {
    prodNameScope .add(colName );
    docIdScope .add(selDocID );
}

Postopen event:

var nameList = new java.util.ArrayList();
sessionScope.put('scopeProdName', nameList );
var idList = new java.util.ArrayList();
sessionScope.put('scopeDocID', idList );

On the next pages the item displayed well, but i want the selected item to be copied and save as a response document to the main document.

i have tried the below script but did not work:

var PN = sessionScope.get("scopeProdName[indexRowdata]");
document1.replaceItemValue("_Title", PN);

anyone have idea how i could go about this. thanks in advance.

1

1 Answers

0
votes

if you display the articles in a view control you can get the id:s of then using

 var myArray = sessionScope.get("projectName");
 var PNu = sessionScope.get("projectNumber");

 document1.replaceItemValue("ProjectName", myArray);
 document1.replaceItemValue("ProjectNumber", PNu);

 var PN:java.util.ArrayList = sessionScope.get("scopeProdName");

 document1.save()
 var Id:java.util.ArrayList=sessionScope.get("scopeDocID");

 for(var x=0;x<Id.size();x++){
   var doc=database.getDocumentByUNID(Id.get(x)); 
   var newdoc:NotesDocument=doc.copyToDatabase(database);
   newdoc.makeResponse(document1.getDocument());
   newdoc.save();
 }