KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Avoid dialog windows when running in headless mode
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: August 1, 2022

When running 4D in headless mode, it is recommended to avoid any dialogs from displaying as this would prevent the process from completing and abruptly abort. One way to find out whether any dialog is trying to display is to check the diagnostic log that is automatically enabled when running in headless mode. Open the diagnostic with any text editor and search for "error" to check whether any error is occurring from a dialog display and to adjust the code accordingly to work with headless mode.

For example, the headless attribute can be used to detect whether the application is running headless mode like so:

C_OBJECT($application_o)
$application_o:=Get application info

If ($application_o.headless)
   // Handle headless code here
Else
   // Handle non-headless code here
End if