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 function requires a data store entity reference, which you'll create with a constant.

Create Constant

The above example shows a constant we filled out to use for our query.

To create your own constant,

  1. From your application, click New, then select Constant.

  2. Name and describe your constant.

  3. Click on the Type dropdown, and select Data Store Entity.

  4. Click on the Data Store dropdown, and select your data store.

  5. Click on the Entity dropdown, and select the same entity your record type references.
  6. Enter a folder where you want to store your constant in the Save In field. If you don't have a suitable folder, you can create one by clicking the Create New Rule Folder link directly below the field.

Now that you have a constant for your entity, you can reference it in a query.

Create Query

image_5

The above example shows a query we created to return the 7 columns from our entity we want to display in our record view. If you want to return all fields from your record, remove the selection property (lines 4-14) from the query, as described here.

To create your own query,

  1. From your application, click New, then select Expression Rule.
  2. Name and describe your expression rule.
  3. Enter a folder where you want to store your expression rule in the Save In field.
  4. Click Create. This will open the expression rule designer.
  5. From the Rule Inputs panel on the right, click New Rule Input. This input is for your record's ID (primary key value).
  6. Provide an appropriate name for your input in the Name field, and set the Type to the type of your primary key field.
    In the below image, you can see we named our input orderID.
  7. In the expression panel on the left, enter your entity query.

You can test your query by entering a record ID in the Value field of the Test Inputs panel. Click Test Rule (or use the appropriate keyboard shortcut) to see if your query works. If successful, your query should return a value of type Any Type (Dictionary) in the Test Output section.

In the below example, you can see what the results of a successful query look like for our Order record.

image_6

Create a Record View Interface

  1. From your application, click New, then select Interface.
  2. Fill out the Create Interface form, then click Create & Edit.
  3. Select the Basic Page outline. 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 that rule with the query rule you created.

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

rule!OrderSimpleView(
  	rule!getOrderInfoByRecordID(rf!id)
)

In the above example, we pass the record ID with rf!id to the query rule 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