How to: Redesign Forms with Expand and Collapse Functionality

Microsoft Dynamics Nav 2009

Some forms have a list layout with hierarchy. On these forms, not all lines in the list have the same level in the hierarchy. Subordinate lines may be indented, or may be grouped so that you can expand and collapse the group. If you want to transform a form with a hierarchical list and with expand and collapse functionality, you must modify the C/AL code in the OnOpenForm trigger so that all the lines are expanded. The RoleTailored client must have all lines expanded so access is available to all lines to determine which lines to indent and by how much. If you do not modify the code, the transformed page will not work correctly.

Some examples of forms in the standard application that have hierarchical lists and have expand and collapse functionality are the following:

  • Form 5522, Order Planning

  • Form 5847, Average Cost Calc. Overview

  • Form 6520, Item Tracing

For more information, see OnOpenForm Trigger.

To redesign a form with expand and collapse functionality

  1. Click the Tools menu, and then click Object Designer.

  2. In Object Designer, select Form, select the form that you want to transform, and then click Design.

  3. Click the View menu, and then click C/AL Code.

  4. In the Form - OnOpenForm section, add the following code.

    IF ISSERVICETIER THEN
     ExpandAll
    ELSE
     InitTempTable
    
  5. To save and compile your form, close the form in Form Designer. In the Save Changes window, confirm that the Compile check box is selected, and then click Yes.

Community Additions

ADD
Show: