Search code examples
xpages

Intermittent behavior in xpages application: by pressing the button to save, the document is not redirected and is displayed again


I'm having a problem with a new xpages application that was deployed in production for a few months, but has now only been expanded to the entire enterprise now. The problem that did not happen while the application was in production pilot is intermittent and happens when an action executes a current notesxsppdocument save (currentdocument). The symptom is that by pressing the button you save, the document is not redirected and is displayed again. What can be this problem. session timeout, a bug from xpages? The application basically uses the components of the extension library, there is no external component to the xpages. When the problem occurs, if the user closes the document's xpages opens again and then clicks the button again the code runs successfully.

I have a function that stores a file attached to the doc in a repository. I suspect she's the problem. The function uses the file upload component and a button to execute a java agent that stores the file in a repository. The button code below follows. Its function is basically to create the rich text if it does not exist and call the agent that consumes a web service to transfer the file to a repository and erase it from the document.

I asked the user not to use the function for a few days at the time of the service to verify that the problem will persist.

if(validaArquivo())
{

var url=@ReplaceSubstring(context.getUrl(),"openDocument","editDocument")
url += '&tab=dossie' ;
var fieldItem:NotesItem = 
currentDocument.getDocument().getFirstItem("arquivos");
    if (fieldItem==null){
        // create the field as an RTF
        //writeToLog("Creating xxxxx field");
        var rtItem:NotesRichTextItem = 
        currentDocument.getDocument().createRichTextItem("arquivos");
        currentDocument.save(); 
    }else if (fieldItem.getType()==1280){
        //writeToLog("--> Converting xxxxx to RTF");
        currentDocument.replaceItemValue("arquivosTEXT", 
        fieldItem.getText());
        fieldItem.remove();
        var rtItem:NotesRichTextItem = 
        currentDocument.getDocument().createRichTextItem("arquivos");
        currentDocument.save();         
    } 
var agente:NotesAgent=database.getAgent("(SalvaAnexos)");
agente.runWithDocumentContext(currentDocument.getDocument(true));
context.redirectToPage(url)
}
else
{
 document1.removeAllAttachments("arquivos");
}

Solution

  • When users are using the application, rebuild or to change some code on prod environment can cause this.