As I personally feel its not very easy to rectify replication problems in Lotus Notes.Moreover when it comes to Developers,It is more puzzled :).I always care few important points in replication either for database or documents level problems.Here they are :

Why are deleted documents reappearing?

A purge interval prevents replication of deletions
When a document is deleted, it leaves behind a deletion stub. When the database replicates, the deletion stub is used to identify and delete the same document in the replica. To save disk space, Notes purges deletion stubs that remain from document deletions according to the replication setting "Remove documents that have not been modified within the last [ ] days." If Notes purges the deletion stubs before they have a chance to replicate, deleted documents can reappear after the next replication.

A document edit writes over a document deletion
When the same document is modified on different servers between replication sessions, the "winning" document is the one modified most frequently, or if both are modified only once, the winner is the one modified most recently. If a document is edited multiple times on one server and deleted on another server between replication sessions, the edited document "wins" because it underwent the greatest number of changes, even if the deletion was the most recent change. If somebody deletes a document on one server and then someone else updates the document on another server once between replication sessions, the edit overrides the deletion because both documents were updated once and the edit occurred after the deletion.

Why are replicas different sizes?

Replication settings
Some replication settings cause one replica to receive only a subset of documents and features from another replica.

Access control list
The access control list (ACL) prevents a replica from receiving all documents or design elements from a source replica.

Read ACLs or reader names fields
A destination server isn't included in a Read ACL or Reader Names field and therefore doesn't receive all documents from a source server replica.

View indexes
A view is used in one replica but not in another; the replica containing the unused view is smaller because no index is built for the unused view.

Personal agents, views, or folders
These features used on one replica, but not another, can cause a size disparity between the replicas.

Deletions not replicated
The replication setting "Do not receive deletions" or "Do not send deletions made in this replica to other replicas" is selected.

Unused space
One replica has been compacted while another hasn't.

Why are unexpected deletions occurring in a replica?


You can prevent a database from receiving deletions made in other replicas by selecting the replication setting "Do not receive deletions." You can prevent a database from sending deletions by selecting the replication setting "Do not send deletions made in this replica to other replicas."

Unexpected deletions may also occur for any of the following reasons:

There is a new replication formula in place
A new replication formula overrides previous formulas and removes documents that don't match the formula.

A replication setting is automatically removing older, unmodified documents
The replication setting "Remove documents not modified in the last [ ] days" removes older, unmodified documents. If the specified number of days is low, consider increasing the value.

Why aren't deletions replicating?

Servers don't have adequate access to the database
To receive document deletions, the ACL on a destination server replica must give the source server Editor access or higher and have "Delete documents" selected.

A replication setting is preventing deletions from replicating
A source server doesn't send deletions to another replica if the replication setting "Do not send deletions made in this replica to other replicas" is selected. A replica doesn't receive deletions if the replication setting "Do not receive deletions" is selected.

Why can't I change which documents are replicated to my local drive?

To change which documents are replicated to your local drive, click the replica, choose File - Replication - Settings, click the Space Savers icon, and select the options you want.

Why can't I limit the documents I receive when I replicate?

To limit the documents you receive when you replicate, click the replica, choose File - Replication - Settings, click the Space Savers icon, and select the options you want.

Why can't I replicate?


Database-related issues
No changes have been made recently. Replication only occurs when there are changes to replicate.

The database is not scheduled to replicate. Check schedule replication .

Replication is temporarily disabled. To enable replication, choose File - Replication - Settings, click Other, and deselect "Temporarily disable replication."

The replica IDs are not the same. (Databases with different replica IDs cannot replicate.) Examine the replica ID for each database and make sure they match. If the replica IDs don't match, create a new replica and then clear the replication history on any other replicas to ensure that the next replication is a full replication.

The access control list on one of the replicas may have changed since the replicas were created so that you no longer have the same access level to both replicas.

Server-related issues
A server doesn't have sufficient access in the access control list of one of the replicas. Check that the access control list for each database gives sufficient access to servers. See About server access levels and replication .

The consistent access control list option is preventing replication. The message "Replication cannot proceed because cannot maintain uniform access control list on replicas," indicates that the "Enforce a consistent Access Control List" option has been set on a replica but the server storing the replica doesn't have the Manager access required to replicate the access control list. Give the server Manager access.

A server doesn't have access to a directory link. If a source server uses a directory link to point to a replica, the destination server must be given access to the directory link in order to receive changes.

There is a server or network problem. A variety of server conditions can prevent replication including mistakes in Connection documents, servers that are down, hardware or software problems, and so on.

The destination server is out of hard disk space.

Why do I see the message "Database is not fully initialized yet"


A replica stub on a workstation hasn't been manually replicated
If users create replica stubs on their workstations and don't populate them with documents according to a schedule, they must manually replicate to populate the replica with documents.

The server storing the replica stub doesn't have adequate access to pull information
If you rely on scheduled replication to populate a replica stub, the server storing the replica stub must have at least Reader access in the source server replica ACL to pull the documents from the source server.

An appropriate connection record between two servers isn't in place
If you rely on scheduled replication to populate a replica stub on a server with documents from a replica on another server, a correctly-configured connection record must exist between the two servers storing the replica and the replica stub. Confirm with your Notes administrator that an appropriate connection record exists.

Replication is disabled
Notes cannot populate a replica stub if replication is disabled on the source or destination server replica. To see if replication is disabled, select the database icon, choose File - Replication - Replication Settings and click the Other icon.

Why does a new replica contain the access control list of the source server when I didn't copy the access control list?


Somebody modified the access control list on the source server before initial replication occurred
If you create a replica stub and somebody modifies the access control list (ACL) on the source server before initial replication occurs, the ACL on the source server becomes the most recent one and replicates to the replica stub. Simply opening the Access Control List dialog box on the source server replica and then closing it can cause this problem.

The server times are out of sync
If you create a complete replica immediately (rather than creating a replica stub) and the time on the source server is later than the time on the destination server, the new replica contains the ACL from the source server.

Why doesn't a replica database contain all the documents it should?

If none of the following explanations apply, try clearing the replication history.

Replicas are temporarily out of sync
If changes made to one replica have not yet replicated, the sizes of replicas may be different until replication occurs.

The source server has insufficient access
The source server access in a destination replica ACL determines what the destination replica can receive from the source server. Give the source server higher access in the destination replica ACL if necessary. The following message in the server Notes Log (LOG.NSF) indicates insufficient server access: "Access control is set to not allow replication."

You haven't included a destination server in an access list
Access lists allow only a subset of people and servers in the ACL to access documents. If such access lists exist, add the destination server to them in the source server replica. If the access list uses a role to define access, add the destination server to the role on the source server replica.

An intermediate server has insufficient access
If replication between a source and destination server occurs through an intermediate server, make sure the source and destination server replica ACLs give the intermediate server high enough access to replicate all changes.

Replication settings are filtering documents
Some replication settings acts as filters that screen out documents and features. Check the replication settings.

The server is out of disk space
Ask your Notes administrator if the server is out of disk space and if so, investigate moving a replica to another server or deleting databases on the server.

Older documents weren't replicated to a new replica
When the replica was created, the date specified for the replication setting "Only replicate documents saved or modified after ( )" is later than it should have been. Create a new replica with an earlier date specified.

Why don't changes to the database title replicate?

If the replication setting "Do not send changes in database title & catalog info to other replicas" is set on the source server replica, the title won't replicate. Deselect this setting to replicate a database title.

Why isn't a replica database receiving access control list changes?

To receive access control list (ACL) changes from a source server, the replica database on the destination server must give the source server Manager access and the source server must give the destination server at least Reader access.

Why isn't a replica database receiving design changes?


To receive design changes from a source server, the replica database on the destination server must give the source server at least Designer access and the source server replica must give the destination server at least Reader access.

Here they are. Feel free to let me know if something else you guys check in replication related problems.

why is it that sometimes there are documents not included during replication process?

In the Basics tab of the Database Properties box, there is a button "Replication History," which opens the window of the same name. The first time one server replica successfully replicates with a replica on another server, IBM® Lotus® Domino(TM) creates an entry in the replication history. The entry contains the name of the other server, as well as the date and time of the replication. Separate entries are created when a replica sends information and when a replica receives it. On each subsequent replication with a specific server, Domino updates the entry in the history to reflect the most recent replication.
Domino uses the replication history to determine which documents to scan for changes during the next replication. For example, if a database successfully replicated with the HR-E/East/Acme server 24 hours ago, Domino replicates only those documents that were added, modified, or deleted in the replica on HR-E/East/Acme within the last 24 hours.
Before replication starts between two databases, Domino checks the replication history of both databases to make sure that they agree. If they don't, Domino scans each document created or modified since the date specified in the "Only replicate incoming documents saved or modified after".

If a database doesn't replicate successfully, Domino doesn't update the replication history.

To resolve this ,Clear the replication history only as a last resort to solve replication problems. If you clear the history, during the next replication, Domino scans each document created or modified since the data specified in the "Only replicate incoming documents saved or modified after" setting on the Other panel of the Replication Settings dialog box. If you clear the "Only replicate incoming documents saved or modified after" setting, Domino scans all documents in the database. Scanning all these documents can be time consuming, especially over dial-up connections.

Yesterday I got a mail from one of the Notes developer from Notes Forum with below contents :

We recently upgraded our Notes environment from R5 to R7 and currently running to an issue with one of my workflow database. I have an 'Author' field which capture names, date and time when users approve/validate a request. This field stop working since when users validate requests with R7 Client.. If users approve a request with R5 Client, their names appear in the field.


I'm using the following code in the Terminate Event of the "Author" field. When users approve a requests, the approver name, date and time supposed to be appended to this field but it's blank now. Can you please help me modifying the code?


Sub Terminate
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument

Author = uidoc.FieldGetText ("Author")
RevApproval_a = uidoc.FieldGetText ("RevApproval")

If Author = "" Then
If RevApproval_a <> "" Then
Author = "Completed by " & session.CommonUserName & " on " & Format(Now(), "Long Date")
Call uidoc.FieldSetText ("Author", Author)
Call uidoc.save
End If
End If
End Sub


I don't have R5 client So, I was not able to test the code.But tested in R7 and it was not working (Can't check in debugger also because it doesn't work in Terminate event).When I analyze the code , I don't find anything wrong with that.In jiffy I modified the code and send back to that person , Since it was urgent request.My code was -

Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim uidoc As NotesUIDocument
Set uidoc = workspace.CurrentDocument
Dim doc As NotesDocument

uidoc.EditMode=True
Set doc=uidoc.Document

If doc.GetItemValue("Author")(0) = "" Then
If doc.GetItemValue("RevApproval")(0) <> "" Then
Call doc.ReplaceItemValue("Author","Completed by " & session.CommonUserName & " on " & Format(Now(), "Long Date"))
Call doc.Save(True,False)
End If
End If

After replying him, I thought to analyze the code and something has instantly strikes in my mind "Will NotesUIdocument works in terminate event?" I have tested his old code in some other event and it worked as he expected.It was very small thing , But skipped from my mind :(

Further more I thought to dig something more about Notes events, I found something useful for those who always skips small things , like me :)

* You not use Initialize for anything except agents, and not use Terminate at all

* Each object has a Declarations area where you can write non-executable statements that apply to all events in the object, and an Options area for statements such as Option, Use, UseLSX, and Const. Each document and view has a Globals area where you can write non-executable statements that apply to all objects in the document.

* Changes made to the current document in a PostOpen event are treated as default values. The document is not marked as changed. If the user closes the document at this point, the PostOpen changes are lost. You must explicitly save the changes, for example, with the Save method of NotesUIDocument, if you want to be sure they are applied.

But still a question, how to debug your code which is in "Terminate" event ?
I think only way "MSGBOX" :) , Anything else you guys know ?

preload preload preload