I have an xpage where I want to have the user enter four input fields and then create a new document, and immediately have the document show in a dojo data grid on the same page. I am using managed beans for all backend data. I have one bean for the main document, and a second bean for each related data. I will tie them together using the UNID. The input fields are all bound to the shipperBean.
My issue is that the parent and only the first sub document is created. It seems like I need to instantiate a new bean, but I thought that was done for you, as in 'managed' for you.
In my button I have the following SSJS:
var POdata:NotesDatabase = session.getDatabase(database.getServer(), "PO\\PO-data");
lineItemBean.saveLineItem(POdata); //MUST save line item in order to tie Shipper to Line Item
var liUNID = lineItemBean.getThisUNID();
var poUNID = lineItemBean.getParentUNID();
shipperBean.saveShipper(POdata, liUNID, poUNID);
shipperBean.deleteCurrentShipper();
The button performs a partial refresh on the table holding the input. The saveShipper() method saves the bean to a new document in a different nsf. The deleteCurrentShipper() method simply sets the instance vars to null. This causes them to be wiped out and ready for the next document. The front end correctly is updated to reflect the wiping out of the values. Any entering of values after the first time not saved to a new document, although they are cleared each time on the front end.
Do I need to create a new instance each time, or can I reuse the same instance like I am attempting?
Should I use a POJO instead and create it myself?
Should I not use SSJS and do it all in another java method and call that?
Should I make the second bean a property of the first?
Is there something simple I am missing?