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.
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 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 in the Application Designer, 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-28) from the query, as decribed here.
You can test your query by entering a record ID in the Value field of the Test Inputs panel. Click Test Rule 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.
From your application in the Application Designer, click New, then select Interface.
Fill out the Create Interface form, then click Create & Edit.
Select one of the Dashboard templates.
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.
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:
To learn more about creating interfaces, see Interface Designer.
Open the record type from Application Designer.
In the Record View Details section, under Views, click + New View.
Enter a name for the new view in the View Name field.
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):
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.
On This Page