Something I've been suffering from for more than three times (and counting :-) ) is the problem that you find when you use more than one datasource in the same XPage. It's time to write it down.
You open a document in an XPage by using an UNID passed in the documentId URL parameter and you discover that the edit controls linked to the second datasource are showing information from the first one. You check the datasource names and the edit control field data and everything is OK.
This can be solved by setting the ignoreRequestParams to true in the second datasource. By default it's set to false and the datasource, despite its configuration is linked to the document passed in the URL.