8.5.3 Domino release gave us new and nice options in XPages development. I'm discovering them by chance while working. :-)
One of them is the new property WebQuerySaveAgent in the Data section of the XPage All properties. There, you can include your "classical" WebQuerySaveAgent. It gets triggered when you submit the Xpage and just before saving the document to disk ( as it used to be ).
You can use a typical LotusScript or Java agent , and you must use NotesSession.DocumentContext, in the agent (old stuff), to instanstiate the document being sent . It even supports the SaveOption flag to prevent the document from being saved.
In order for this to work the agent must have the "Run as a web user" field checked.
This new property makes it easier to use legacy agents, and can keep us away from using the 8.5.2 method runWithDocumentContext .
A good addition to XPages development for modernizng old applications.