0

I am maintaining an XPage application that has started creating multiple replication or save conflict documents BEFORE the initial document is saved. How can this be happening and how can it be prevented?

Users create a Contract in XPages application and have not yet saved the document so no other user should be able to see it, but when they save anything from 3 to 10 duplicates are created. It also appears to happen at random, that is at random times for random users. When I go into the core Notes database I can see them in an example shown below.

enter image description here

Here is the only refernce to a document datasource I can find.

<xp:this.data>
   <xp:dominoDocument var="document1" formName="Contract"   computeWithForm="both">
      <xp:this.postSaveDocument>
          ...........
      </xp:this.postSaveDocument>
   </xp:dominoDocument>
</xp:this.data>
AJF
  • 1,801
  • 4
  • 27
  • 54
  • Show us some code - specifically your data sources as Paul mentions. – Per Henrik Lausten Aug 22 '14 at 11:49
  • 1
    @PerHenrikLausten. The code is quite extensive and I will have to find a few specific examples to post up. I am not from an XPages Notes background so please bear with me – AJF Aug 22 '14 at 12:48
  • @PerHenrikLausten. I have added the only datasource I can find – AJF Aug 22 '14 at 15:01
  • I think we are going to need more code for this. If the document is saving before the user clicks save then you have some code that is executing a save during some event, if that is the case I could see some situations where this could cause a problem. – Patrick Sawyer Aug 22 '14 at 19:33
  • @PatrickSawyer. Yes Patrick. I am no expert in XPages but i feel this one is a bit of a mystery – AJF Aug 25 '14 at 09:34
  • Any chance you can post more of the code then? – Patrick Sawyer Aug 25 '14 at 15:50

1 Answers1

3

The most typical way multiple save conflicts are created for new documents is if the XPage has multiple dominoDocument datasources on the page and using a Button of type Submit or using the Save Data Sources simple action.

If datasources do not have ignoreRequestParams="true", all data sources are editing the same document, regardless of any other properties defined for the individual datasources.

The Save Data Sources simple action, as its name implies, saves all datasources on the page. However, a button of type Submit will submit the form, which tells the server to also save all datasources, not necessarily restrict functionality to any SSJS defined in the event.

Paul Stephen Withers
  • 15,699
  • 1
  • 15
  • 33
  • Please bear with me as I am not from a Notes and Xpages background. When you say datasources I take it you mean if there are multiple text elements on the Xpage that are set to different fields on the notes document? If that is what you mean then yes there are numerous text elements set to different notes document fields and there are several tabs on the Xpage too – AJF Aug 22 '14 at 12:56
  • 1
    No, the fields will be fine. It's if you have multiple dominoDocument datasources on the page. By default they take their settings (database, form, create/edit/open action) from the current URL. ignoreRequestParams="true" for a dominoDocument will allow you to override loading the settings from the URL. So if you have multiple dominoDocument datasources, all but one should have ignoreRequestParams="true" – Paul Stephen Withers Aug 22 '14 at 13:11
  • 1
    Tim Tripcony gave a great explanation here http://stackoverflow.com/questions/16848253/xpage-with-multiple-datasources-has-the-second-datasource-always-opened-in-edit – Paul Stephen Withers Aug 22 '14 at 13:14
  • Thanks for prompt repsonses. So by data source do you mean the actual database document being created for the Contract? (the Xpages app is all about Contracts) For example document1? – AJF Aug 22 '14 at 13:51
  • Performed a complete file search in project for ignoreRequestParams= and there are none found!!! – AJF Aug 22 '14 at 14:11
  • Any sp:dominoDocument, e.g. . From your search, all such dominoDocument datasources are retrieving their settings from the URL. So if you have more than one datasource on a page, they will be pointing to the same datasource on the page. – Paul Stephen Withers Aug 22 '14 at 15:01
  • I just added the only data source reference I found in code to my original post – AJF Aug 22 '14 at 15:04
  • If your postSave contains any .save that would explain it. Or are there agents that do onCreate/Change? – stwissel Aug 22 '14 at 16:48
  • If you're new to XPages I would suggestion you check out my site at NotesIn9.com. It has 150+ free video tips on XPages Development. Also - If you posted some code we could probably help you better. What we mean by dataSource is a document or view typically. For instance if you have multiple custom controls and each is bound to the same document then that might cause this problem. – David Leedy Aug 23 '14 at 12:27