In this example, you have a form containing a Client Item view and Client List view. When you generate a form using multiple views, K2 automatically creates a default rule called When the Form is Initializing, which executes the Initialize method for all views when the form opens. The image below shows the default Initializing rule for this example.
Default rule configuration
If a view contains many records, such as the Client List view in this example, the Initialize action may cause a performance impact when the view loads because the form is locked until all views are loaded. To improve the user experience and speed up the load time of the form, you can move the then on Client List View, execute the Initialize method rule action to an Expand rule which only executes when the person expands the view. This allows you to execute the Initialize method of the Client List view when the view is expanded. You must also add an action to collapse the Client List view when the form loads. The images below show what the enhanced configuration looks like.
Enhanced rule configuration of the Initializing event containing the collapse method
Enhanced rule configuration showing the Expand event containing the Initialize method
Essentially, the rules are as follows:
- The form loads with the (Initializing) event.
- The Client Item view loads
- The Client List view collapses.
- When you click to expand the Client List view, the view loads.
Follow the steps below to configure the rule shown above.
- Edit the When the Form is Initializing rule, select then on Client List View, execute the Initialize method and click Remove or the click the Remove icon as shown below.

- In the Actions tab, click the Collapse a View action in the Visibility section, and then select the Client List view as shown below.
Click OK to save the rule.

- Click Add Rule to add a rule when the Client List view is expanded.

- In the Events tab, click the When a View raises an event event in the View Method section, and then select the Client List as the view and Expand as the method as shown below.

- Add the Initialize method that you removed from the default form Initialize rule. Go to the Actions tab, click the Execute a View method action in the SmartObject Interaction section, and then select the Client List as the view and Initialize as the method as shown below. Click OK to save the rule. The Client List view now opens when the view is expanded instead of when the form opens.

- Save and finish the view, and then run the form to test that the view load-when-expanded behavior works as expected.