Adding debug print messages to Groovy extension scripts

When adding debug messages to Groovy extension scripts in WFM, errors can occur instead of the expected debug output if the DebugPrint messages are not coded correctly. Common error messages include:
  • Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object
  • No such property: DebugPrint for class: groovy.lang.Binding

To resolve the issue, the DebugPrint class must be included as one of the imports at the start of the script:

import com.workbrain2.platform.publ.api.DebugPrint

Next, all lines defining the desired debug messages should qualify their use of the debugprint method with its class name like this:

DebugPrint.debugprint("message_content")

See KB3615058 for more information.

  1. To add debug print messages to an extension script, login to WFM as a system administrator.
  2. Click Maintenance > System Administration > Scriptable Extensions > Extension Script Tester.
  3. Open the Groovy extension script to add debug output.
  4. At the top of the script, add the import statement if it is not already present:
    import com.workbrain2.platform.publ.api.DebugPrint
  5. In the script body, add debug statements where needed, for example:
    DebugPrint.debugprint("Test message")
  6. Save the script and run your normal process or rule execution to generate log output.
Note: These following combinations result in errors when you run the script:
  • If the debug messages are coded as simply debugprint("message")' and the DebugPrint class is not imported first, this error is displayed:
    Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object (script17490753495371967955061 debugprint line 1 message)
  • If the debug messages are coded as DebugPrint.debugprint("message") and the DebugPrint class is not imported first, this error is displayed:
    No such property: DebugPrint for class: groovy.lang.Binding
  • If the DebugPrint class is imported and the debug messages are coded as simply debugprint("message"), this error is displayed:
    Scripts not permitted to use method groovy.lang.GroovyObject invokeMethod java.lang.String java.lang.Object (script1749075549508278284712 debugprint line 3 message)

This behavior applies to any Groovy extension script type that uses DebugPrint for logging.