10. Create a Read-Only List View

In the next three steps, you will create new views to compliment your Expense Claim forms. The first view is a read-only list of expense claim line items and appears on the approver's and finance processor's forms. The second view is an editable list of expense claim line items and appears on the requester's
"new" and "edit" forms. Finally, you will create a new item view that contains a single comment box. Both the approver and the finance processor can use this view to enter any questions or comments they have when making their approval decision.

Begin with the read-only list view.

  1. Add a new view to the application with the following settings:
    FieldValue
    NameExpense Claim Line Items List
    DescriptionRead-only list of expense claim line items.
    Category(leave default value unchanged)
    View TypeList View
    Data SourceUse the browse icon to select the Expense Claim Line Item SmartObject
    List MethodGet List
    Call this method when the form loadsNOT checked
    1. From the K2 Application elements page, click the New icon and select View.
      New View
    2. Configure the GENERAL settings for the new view as follows (then click CREATE):
      FieldValueNotes
      NameExpense Claim Line Items List 
      DescriptionRead-only list of expense claim line items. 
      Category(leave default value unchanged) 
      View TypeList ViewList views display lists of items as opposed to a single item.
      Data SourceUse the browse icon to select the Expense Claim Line Item SmartObject.
      This is the SmartBox SmartObject that you created to store the expense claim line items. (Your tree structure may not match the image exactly depending on your site and subsite names.)
       
      List MethodGet ListThis is the default method that populates the list.
      Call this method when the form loadsNOT checkedYou do not want the list view to populate automatically whenever it opens. You will configure a rule that populates the list view with the requester’s expense claim items. If you didn't do this, all of the expense claim items (in the SmartObject) are returned, regardless of the requester.
      List View General Settings
  2. Create Labels and Controls for all fields except the ID and Expense Claim ID. Do not allow list editing.
    1. On the LAYOUT screen, click the Create Labels and Controls link.
    2. When you select Create Labels and Controls, K2 gives you an option to select which fields (SmartObject properties) you want to display on your view. The Create Layout Table Only option creates a blank table where you can drag and drop controls yourself.
    3. On the Create Labels and Controls screen, select all the fields except for ID and Expense Claim ID. Do not select the Enable list editing option, then click OK. Remember, this is a read-only list, you do not want your users to edit it.
  3. Enable Wrap Text for the Description column. Finish the new view, then check it in.
    1. Select the Description column, then select the Body tab in the Properties pane. Enable the Wrap Text property. This way, you don't have to scroll to read the entire description.
    2. FINISH the new view. On the K2 Application elements page, Check In the Expense Claim Line Items List view.
Review

In this step, you added a new read-only view to display expense claim line items. This view appears on the approver's and finance processor's forms. In the next step, you will create the editable list view of line items. This view appears on the new and edit forms so the requester can enter, edit, and remove expense claim line items.

Next Step: 11. Create an Editable List View
Expense Claim Application