Debug Your Groovy Scripts

Use the Groovy debugger in Application Composer to debug the object functions and validations that you defined for an object. While debugging, you can also examine object and attribute values. Access the debugger from either the Custom Objects or Standard Objects page.

Accessing the Debugger

Access the debugger from either the Custom Objects or Standard Objects page in Application Composer.

To access the debugger:

  1. In Application Composer, under the Objects tree, click either the Custom Objects or Standard Objects link.

  2. On the resulting Objects page for either custom or standard objects, select the object that you want to debug and then click the debugger icon in the table's toolbar.

    The debugger icon is a ladybug.

  3. On the debugger UI, examine the object functions and validations defined in Groovy for that object.

Using the Debugger

The debugger contains multiple regions, described in the following table, which you can use to debug your scripts for an object:

Debugger Region

Description

Main toolbar

From the toolbar, you can select the object to examine and start the debugging process.

Left pane region

This region displays the object functions and validations defined for the selected object.

Main script region

This region displays the selected Groovy script.

Stack region

This region displays the call stack. For example, assume there are two functions, Function1 and Function2. Function1 calls Function2. When debugging within Function2, the Stack region displays which statement from Function2 is currently being executed, as well as information about the parent Function1 from where Function2 was called.

Variables region

This region displays variables and associated values.

Breakpoints tab

This tab displays which statement (line number) has a breakpoint. A breakpoint is a location in a Groovy script where you want the script to pause during debugging. The debugger stops at that statement.

Log tab

This tab displays all logs. If the script has any println() statements, then those values are captured on this tab.

To use the debugger:

  1. In Application Composer, under the Objects tree, click either the Custom Objects or Standard Objects link.

  2. On the resulting Objects page for either custom or standard objects, select the object that you want to debug and then click the debugger icon in the table's toolbar.

  3. On the debugger UI, the left pane displays the object functions and validations defined in Groovy for that object. Select the script that you want to review.

    The script is displayed in the main script region.

  4. To start debugging, click one of these icons in the toolbar:

    • Step Over

      Review one statement in the selected script at a time.

    • Step Into

      If a statement in execution is a call to some function, and you want to debug inside that function, then click Step Into.

    • Step Out

      If you are debugging inside a child function and you want to move the control back to the parent function, then click Step Out.

    • Run

      Move to the next breakpoint in the script. If no further breakpoints exist, then the debugger completes its evaluation of the selected script and then closes the debugger session.

Enabling and Disabling the Debugger

The debugger is enabled by default. However, if you want to hide the debugger, or later show it again, then set the ADF: Enable Script Debugger profile option.

To set the ADF: Enable Script Debugger profile option:

  1. In the Setup and Maintenance work area, select the following:

    • Offering: Sales

    • Functional Area: Sales Foundation

    • Task: Manage Administrator Profile Values

      The Manage Administrator Profile Values page appears.

  2. In the Profile Display Name field, enter ADF: Enable Script Debugger and click Search.

  3. In the Profile Values region, at the Site level, enter either TRUE or FALSE.

    • TRUE displays the debugger.

    • FALSE hides the debugger.