Create a Record View

Record views are interfaces designed for displaying record information. Record views are created the same as any other interface.

This article illustrates a method for creating and configuring a record view for an entity-backed record. The entity-backed record is the most common record type, and the easiest to configure.

For record types whose data is sourced from a process, we recommend the process-backed record tutorial. For record types whose data is sourced from an expression, we recommend the expression-backed record tutorial.

To create a view for an entity-backed record, we'll need to do three things:

  1. Create an Entity Query to fetch the record's information that will be displayed in the view.
  2. Create a Record View Interface to display the record's information.
  3. Add the Record View to the Record Type so the user can see the view from the record.

Create an Entity Query

In order to send the interface the right information, you need to create a query to get the data for the selected record using a!queryEntity(). This requires a data store entity reference, which you'll create with a constant. See Using the Query Editor to learn how to easily set this up.

Once you're done, you should have an entity query for the fields you want to display. In the below example, you can see the query we created to return the columns we wanted to display in our record view.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
a!queryEntity(
  entity: cons!CASE_APP_OrderDataStoreEntity,
  query: a!query(
    selection: a!querySelection(
      columns: {
!        a!queryColumn(field: "OrderNum"),
!        a!queryColumn(field: "OrderDate"),
!        a!queryColumn(field: "TaxRate"),
!        a!queryColumn(field: "ShippingCost"),
!        a!queryColumn(field: "Status"),
!        a!queryColumn(field: "Customer"),
!        a!queryColumn(field: "ShippingAddress"),
!        a!queryColumn(field: "id")
      }
    ),
    logicalExpression: a!queryLogicalExpression(
      operator: "AND",
      filters: {
        a!queryFilter(
          field: "id",
          operator: "=",
          value: ri!orderID
        )
      },
      ignoreFiltersWithEmptyValues: true
    ),
    pagingInfo: a!pagingInfo(
      startIndex: 1,
      batchSize: 50
    )
  ),
  fetchTotalCount: true
)

Create a Record View Interface

  1. From your application, click New, then select Interface.
  2. Fill out the Create Interface form, then click CREATE.
  3. From the list of templates on the right, select One Column Form.

    Create Record Type/image 15

  4. Click New Rule Input, then enter the Name of the input, and set the Type to the custom data type for your record.

    In the below example, we titled our input Order and set the type to the custom data type for the order entity.

  5. Click Test, and call the rule you created in the previous section in the Expression field. Make sure to call the rule with an ID for one of your records so we have some data with which we can preview the interface.

    In the example below, we called our rule with record ID 10.

  6. Click Set as default test values, then click Test Interface.

Now you can add components to your interface to display your query results.

Here's what our simple interface preview looks like:

Create a Record View/image 9

To learn more about creating interfaces, see Interface Recipe.

Add the Record View to the Record Type

  1. Open the record type from your application.
  2. In the Record View Details section, under Views, click + New View.

  3. Enter a name for the new view in the View Name field.
  4. Call your interface rule in the Interface section, and pass the record information to the expression rule with the query you created.

Here's how we referenced our interface (OrderSimpleView) with our entity query (getOrderInfoByRecordID):

1
2
3
rule!OrderSimpleView(
  	rule!getOrderInfoByRecordID(rf!id)
)

In the above example, we pass the record ID with rf!id to the query we created, getOrderInfoByRecordID. The query runs and returns the record data, which is then passed to the interface, OrderSimpleView.

You can now save your changes and preview your record view. There's a shortcut to your record list at the top of the record type, in the Properties section; look for a link under Record List URL.

FEEDBACK