0
votes

I have a document data source defined in a xPage and I am calling a java class when a file upload control is changed. The java class compresses the image uploaded via the file upload control, then attaches it to the Notes Document. When I click the save button on the xPage (custom javascript, set to save the datasource) it creates a replication or save conflict.

I'm assuming this conflict is being created because I'm saving the data source in SSJS and the document in java. Is there any trick to prevent the save conflict?

2
Have you tried to set concurrencyMode="force" in your data source? You have to check if the Java/SSJS changes are saved to the document, but in most cases this solves the problems with these conflicts.Sven Hasselbach
I did not know about concurrencyMode (new to xPages in general), so I did try that and it worked! Thank you!user3641366

2 Answers

0
votes

The best "trick" would be to turn your Java class into a managed bean (ViewScope) and bind your input fields not to a document, but properties of the Java bean. Handle the save to the document inside the Java bean. Then you have a single point of save. Keep in mind: you can't keep a document handle around between function calls, so in your bean you would just keep the document id around and grab it when needed. This also mitigates the risk of a save conflict if someone else updates the document inbetween.

0
votes

You can force a page reload after saving the document through SSJS. The document datasource will be reloaded and you won't have a save conflict.

context.reloadPage()