Creating Response Doc From A Selected Document Within A Datatable With Xpages
I try saving my document the document got saved without any error but the response document is no where to be found. The response document is a list of document in a datatable sele
Solution 1:
copyToDatabase()
doesn't work sometimes so well. The workaround and best practice is to create a new document and copy all items.
Your code could look like this then:
for(var x=0;x<Id.size();x++){
var doc=database.getDocumentByUNID(Id.get(x));
var resdoc:NotesDocument=database.createDocument();
doc.copyAllItems(resdoc, false);
resdoc.makeResponse(currentDocument.getDocument());
resdoc.save();
}
Update:
I found the reason for not creating response documents: your Postopen(?) event code never gets executed as SSJS. It would throw an error as is has a capital letter "V" in "ViewScope.put('title'...". Because the code gets never executed viewScope "Id" remains empty and therefore the for-loop which would create response documents is never entered.
Put the correct code in beforePageLoad event and it will work.
<xp:this.beforePageLoad><![CDATA[#{javascript:
var titleList = new java.util.ArrayList();
viewScope.put('title', titleList );
var idList = new java.util.ArrayList();
viewScope.put('id', idList );}]]>
</xp:this.beforePageLoad>
Post a Comment for "Creating Response Doc From A Selected Document Within A Datatable With Xpages"