This was a new one to me and IBM support did a great job of helping us to find the issue.
We modified a customers mail template to add some core business functionality that processed the inbound emails before they appeared in the in-box and provided some quick filing suggestions based on some business rules.
In order to present the options in the UI we had to add information to the new emails – this is where we go caught out.
If you use document.save as part of the “Before Mail Arrives Agent” then the inbox will not refresh automatically – or the refresh will be delayed. On our customers server the refresh failed in 100% of cases whereas on my dev server it was delayed 60% of the time and failed 40% of the time. For IBM support it was never delayed or failed.
When you look at the help document for the DocumentContext property it states
For an agent activated “Before New Mail Arrives,” the in-memory document is the email that is about to be delivered. Because the agent is activated instantly for each email as it’s about to be saved into the mail database, each time the agent runs you are working with a single unsaved document. The UnprocessedDocuments property in AgentContext will not return any documents for this agent type.
So if you modify it you do not need to save it – because it is about to get saved.
So we removed our document.saves while session.isonserver = true and the inbox refresh now works.
Many thanks to Djesus Rex C. Cada from IBM support who went though the past tickets and found the work around for us.