How to Avoid Message Boxes in Server-Side Form Script
Who is this article for?Ideagen Smartforms users configuring the system.
Understanding of Windows server is required.
Using message boxes in form activities designed to occur on the server are generally discouraged. In fact this is not allowed in a service unless you explicitly allow it. You may see the following exception occur in the Ideagen Smartforms Server logs when you attempt it: Looking at a typical exception in this scenario we see:
Description: The process was terminated due to an unhandled exception.
Exception Info: System.InvalidOperationException
Stack:
at System.Windows.Forms.MessageBox.ShowCore(System.Windows.Forms.IWin32Window, System.String, System.String, System.Windows.Forms.MessageBoxButtons, System.Windows.Forms.MessageBoxIcon, System.Windows.Forms.MessageBoxDefaultButton, System.Windows.Forms.MessageBoxOptions, Boolean)
at Microsoft.VisualBasic.Interaction.MsgBox(System.Object, Microsoft.VisualBasic.MsgBoxStyle, System.Object)
at FormBehavior_321461.FSGetWorkPackagesCompleted(System.Object, FSGetWorkPackagesCompletedEventArgs)
Often the result is that your form will not route to the proper queue correctly. Instead it will land in the _SystemError or _Error queue.
Events to avoid using message boxes include:
AfterDataPathsRun(when e.Scope = DataPathScope.Server)
AfterDataPathRun(when e.DataPath.Scope = DataPathScope.Server)
ServerContacted
ServerError
ServerQueuing