Hi and thanks for the answer.
I was using the agent provided with the new template and i did not recreate the logdoc.AM_FormName = newdoc.Form(0) line.
but i wanted to be sure, so i opened my designer to check the agent.
It was a big surprise as the agent was not here...I do not know what happened, but the agent has diseappears from every replica of this database.
so i re-added it and tested and: same error.
i will try to upgrade domino to the last 8.5.3, maybe the dll call fonctions that does not exists under 8.5.1...