Prevent replication or save conflicts in XPages - xpages

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.
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>

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.

Related

Select#all for document UNID in notes not showing all documents

I created a view to retrieve all document UNID in lotus notes. The view selection formula is select#all. The total no.of documents in nsf is 1200 but the view shows 1198 documents what about the other 2 documents. As per my analysis there is no deleted or profile documents present. How to retrieve those two documents please advice. Thanks
Every view in a Notes Database has an option called "Organizing response documents in a hierarchy" that is enabled by default.
That means that documents that do not have a parent document are not shown in these views. In addition reponses might be "invisible" in the view as they are shown "indented" but collapsed without a visible indicator to expand the hierarchy and show the missing documents.
Disabling this view property makes the documents visible again. They might be "real" responses or probably Save / Replication conflicts that occur if one document is saved in two different places at the same time (these places might even be within the same database replica).
Another possibility for "invisible" documents are documents that are protected by reader fields. They are counted to the document count of the database but not visible to you due to your name missing in the reader field.

View will show all list updated form every time changes made

I'm new with lotus notes. Basically, I have a form. I want to create a situation where when I edit the form, that form will not be overwritten but it will automatically create a new form with an updated form. But when I open the new updated form, we can see all list of history from the old form. I can't think of any way to create it. Any suggestion would help me. Thanks!
First of all: you need to know the difference between FORM and DOCUMENT.
The FORM is the design element in designer that you create and that is used to create and modify DOCUMENTS.
A DOCUMENT is a set of item - value pairs stored in the database. The items are based on the FORM it is created with.
If I understand you correctly, you want to create a new DOCUMENT on every save but keep the old DOCUMENT at the same time. There is a function called "Version Tracking" that allows this.
Read this documentation about how to use versioning. Here is a short version:
Open the form.
Choose Design - Form Properties.
On the Form Info tab, select None or one of the following versioning methods:
New versions become responses
Prior versions become responses
New versions become siblings

How to edit a record(s) with multiple form xpage?

I have an xpage that allows the user to choose a customer and then order products for that customer. It's not a simple xpage that created a document, uses a view control to view it and re-edits it. It will be used on the web and in the client. How do I fill in all the data for the various fields when the user wants to look at their order for a company since there are multiple documents that make up that xpage? Is there automatic processes or do I need to do it manually?
The best method is to use multiple datasources (the Notes documents) each with a different datasource name. When saved, be sure to save each of the datasources that have a change. Also, it is helpful to mark to "ignoreRequestParameters", so each one acts independently.
I have found that using the dynamic content control useful when doing things like this, it seems to reduce the number of replication/save conflicts.

Get recently read document in Lotus Notes Database

I am developing a database on Lotus Designer 8.5 environment with LotusScript and LotusFormula.
Is there any possibilities on get a list of recently opened documents (for example last five) in a Lotus Notes database ? My purpose is to provide an embedded view showing the recent documents opened by current user on the current database, which will act like some kind of history view.
Please advise
Use a folder categorized by username. Add the current document in PostOpen event to folder with document.PutInFolder(folderName) and remove the oldest document from folder with document.RemoveFromFolder(folderName)
This way you don't need to edit the documents and can show the last visited documents for a user in an embedded view.
As an alternative you can use user specific folders with option "Shared, private on first use".
I have that functionality in one of my databases.
I just added some code in the QueryOpen event of the form to store the UNID of the document in a profile document linked to the specific user. The values are stored in a multi value field, and my code removes the oldest entry when the number of entries I want to store is exceeded.
The user can actually set that number themselves in teh applications settings, 5 is default but they can make it more or less.
I built a class for this, makes it very easy to modify later, and to implement it in different forms, for different document types.
I then built a method to expose the last documents to the user, using a dropdown box as you can see below. Since you only wwant/need the five (or perhas ten) last documents, no need to use a view.

How to create Lotus form to both enter data and display the same information (Lotus Designer)

Very new to Lotus designer.
I am trying to create a simple form with a field which is updated from time with additional information. I want the admin user to be able to update this information on the same form interface as the user viewing the information.
It appears I do not really understand how to get the form to display information entered into it previously.
I did Ctrl+shift view of the database and saw all the previous entries but I can not seem to get the form to display these information as well as allow me to append to them.
Kindly help.
Thanks.
Have a look at the online Domino Designer help - for instance the sections on designing forms:
http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.designer.domino.main.doc/H_ABOUT__FORMS.html
A form is used to create a new document or to edit an existing document. Since you say that you can see the previous entries, you must be creating a new document for each entry.
If you want to see and modify the contents of an existing document, you have to navigate to the document and open it for edit.
If you want the user to see a list of all the previous documents while he is creating a new one, you can add an embedded view to the form and use that to display data from the previous documents.
If you want all the information to be in a single document, then you need to stop creating new documents and just select the exiting document, open it for edit, make your changes, and re-save the document.

Resources