| InfoPath Integration / General Use |
During an InfoPath Form based process, a user clicks on Submit and Close button of the InfoPath form to submit the form. Before the submission is completed, he/she moves the cursor away to another window. The following error returned even though the InfoPath form is indeed submitted:
'Application.ActiveWindow' is null or not an object File:script.js Line:77

When the cursor is moved away from the current windows, the Application.ActiveWindow.Close called will fail and cause the error.
Replace the code Application.ActiveWindow.Close(true) with new code win.Close(true):
STEP 1: Open InfoPath XSN in design mode
STEP 2: InfoPath Main menu->Tools->Microsoft Script Editor
function AgilePointSubmitAndClose()
{
var win = Application.ActiveWindow;
if( XDocument.IsNew )
{
if( CreateInfoPathForm("","","") )
{
//Application.ActiveWindow.Close(true);
win.Close(true);
}
return;
}
...
//Application.ActiveWindow.Close(true);
win.Close(true);
}
...
If AgilePointSubmitDiffAndClose(attrName) exists, then do
function AgilePointSubmitDiffAndClose(attrName)
{
var win = Application.ActiveWindow;
...
//Application.ActiveWindow.Close(true);
win.Close(true);
}