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:
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.
The above example shows a constant we filled out to use for our query.
From your application, click New, then select Constant.
Name and describe your constant.
Click on the Type dropdown, and select Data Store Entity.
Click on the Data Store dropdown, and select your data store.
Now that you have a constant for your entity, you can reference it in a query.
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.
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.
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.
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.
Now you can add components to your interface to display your query results.
Here's what our simple interface preview looks like:
To learn more about creating interfaces, see Interface Recipe.
In the Record View Details section, under Views, click + New View.
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 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.