Responses in xpages

I create a response document from a button with a simple action (Create response document). In parent ID I have the value Document1.getNoteID() . It creates a response and seems to work. The problem is that I have some fieldvalues that I want to be inherited from the main document to the response. How can I accomplish this?

Subject: My Workaround

I have been unable to find a way to have fields inherit when creating a response document. The only solution I have found for now is setting the response document field values to the values from the parent in the beforePageLoad. Maybe there is a ‘inherit fields from parent’ option but I have not seen it.

Subject: Responses in xpages

Incredible that such an easy task in client could be so complicated in xpages. I have also tried to get the values in beforepageload event but with no success. If you would be kind to share a code snippet I would be very grateful.

Subject: Snippet

In the case below I already have the parent doc ID in a scoped variable(unique i know). You can use ‘DataSourceName.setValue’ to set any of the field values of the response document. There may be better ways to do this but for now this is what I have done. I only have to set a few fields as well. I don’t think you will be able to use context.getURLParameter until the page has loaded. I hope this helps. I have not been working with XPages very long.

var pdoc = database.getDocumentByUNID(sessionScope.pdocUNID);

DataSourceName.setValue(“yourField”,pdoc.getItemValueString(“yourField”));

Subject: Responses

Thank you, finally it’s working as supposed.

Subject: default value

I put something like this in the default value for the field:

database.getDocumentByID( .getParentId() ).getItemValueString( “” );