Modern OData APIs provide flexible filter and navigational properties allow external applications to create complex filters and join tables of related data easily. Performance and flexibility are the main reasons we recommend using the OData APIs. Below is an example for configuring an OData Api data source for Business Central, but the same steps will apply to any OData Api data source in SmartConnect.
Configuring a Business Central OData Api query Data source
- Go to SmartConnect > Data Sources > Bulk Sources > Query
- Click on Create Bulk Query > Select Dynamics 365 Business Central OData Api
3. Give the source a Description and select your Connection and Company.
4. Select Entity, for example, Sales Orders.
5. Now, click on the Select Fields for Sales orders button.
6. Select the required fields and click ok. For example, Name, City.
7. Clicking on Validate will show Validate Dynamics 365 Business Central OData Api was successful. Also, Save and Preview Button are enabled.
Adding Child Entity
Optionally, you can add a child entity to join the main service to a related service. For example, show sales lines associated with this order, or show additional customer information on the linked customer card.
- Add child services to the salesOrders entity by clicking on Plus Button (+) to select child service for Sales Orders, for example, SalesOrderLines.
2. Select the desired fields and click ok. For example, Item Id, description.
Filter a Service
1. Click on the Filter service button
2. Then from the Fields, drag and drop the field needed to filter. For example, Sell to City.
3. Select the Logical operator from the list and drag and drop. For example, the eq operator has a set value to ‘Gillette’.
4. Alternatively, select the Global variable for the set value for the filter.
5. Save and Preview are enabled.
Error Handling
When creating a query data source, you may see the following error.
Validation failure, Field selection is required for service ‘SalesOrders’
Resolutions
Select the required fields for the entity or child entity and click ok.
Another Problem after adding the filter service, you may see this error Failed to create data table: Could not find a property name ‘city’ on the type.
Resolutions
Go to the filter and add ‘’ around the set value.