SmartObject Options
Find the SmartObject OData API configuration at the bottom of the Categories -> SmartObject's page, on the API tab (see SmartObjects).
Configure the list method for the OData feed. This method presents the data. The Use default list method is selected by default. To change the list method used in the OData feed, select the Choose list method to use option and select the list method from the drop down. After changing the list method option, you must refresh the service by clicking Refresh Now.
Changing the default list used in the SmartObject Services changes the data presented in an OData feed of the SmartObject. If custom reports have been created using a different list method, those reports will fail the next time they are updated.
Which List Method is Used?
The SmartObject OData API publishes the SmartObject's data using the configured list method. The following logic flow describes how K2 chooses the default list:
- If there is a chosen SmartObject list method on the SmartObject,
- then the OData API uses that method.
- If there is no chosen list method specified on the SmartObject,
- then the OData API uses the first list method returned by the SmartObject detail as the default list. (Note: The order of methods is not guaranteed.)
- If there is no list method at all,
- then the SmartObject is not published to the OData API.
Use the first field returned as the primary key: The OData feed uses the first property defined in the SmartObject as the primary key. A quick way to know what is the first property is to open the SmartObject in K2 Designer and see what is on top of the list.
Choose field to use as the primary key: The drop down is enabled and the SmartObject's properties are listed. The list includes only properties that are Number, Decimal, Text, and GUID (including autonumber and autoguid). This option is useful when you don't want to edit the SmartObject definition to reorder the properties and so choose which one acts like a primary key for the OData feed.
After changing the primary key option, you must refresh the service by clicking Refresh Now.
The OData API service may throw exceptions or errors when requesting the SmartObject if the primary key is chosen incorrectly.