In the previous post we explored the full power of the Search Query API in Dataverse. Now, let’s shift gears to a more UX-focused capability: the Suggest API.
This feature powers intelligent, type-ahead search experiences that offer suggestions before a full search is even submitted ideal for lookup fields, search bars, and filtering experiences in model-driven apps and custom pages.
What Is the Suggest API?
The Suggest API returns a ranked list of search suggestions based on partial user input. Unlike full Search Query requests that return full records, Suggest responses are lightweight and fast.
Key Characteristics:
- Lower latency than a full search
- Supports filtering by entity/table and field
- Uses indexed fields only
- Returns up to 5–10 suggestions
- Includes highlight support for partial matches
Example API Request
POST https://<env>.crm.dynamics.com/api/search/v1.0/suggest
Content-Type: application/json
Authorization: Bearer eyJ0eXAi...
{
"searchTerm": "con",
"entities": [
{
"name": "account",
"suggestFields": ["name"]
}
]
}
This suggests matching account names that begin or contain “con”, like “Contoso”, “Converge Inc.”, etc.
Sample Response
{
"value": [
{
"entityName": "account",
"entityId": "111-222...",
"suggestedText": "<em>Con</em>toso Corporation"
}
]
}
Fields Explained
| Field | Description |
|---|---|
entityName | Name of the table/entity |
entityId | ID of the suggested record |
suggestedText | Highlighted suggestion using <em> tags |
These values can be rendered as dropdowns or inline hints as users type.
Use Case Scenarios
| Scenario | Suggest API? |
|---|---|
| Autocomplete account name in a form | ✅ Yes |
| Typeahead in global search bar | ✅ Yes |
| Search for leads created in last month | ❌ Use SearchQuery API |
| Suggest values for country picklist | ❌ Use local config or static cache |
🔧 Developer Tips
- Suggestions only return indexed fields.
- Use
suggestFieldswisely too many fields can lead to noisy results. - Apply entity-level filters if necessary using the
filterparameter (same syntax as SearchQuery API). - You can combine
suggestedTextwithentityIdto navigate or auto-fill forms.
Suggest vs Query
| Feature | Suggest API | Search Query API |
|---|---|---|
| Response | Fast, lightweight | Full document result |
| Best for | UX, autocomplete | Full record search |
| Result limit | 5–10 | Up to 100+ |
| Highlight support | ✅ Yes | ✅ Yes |
| Filtering | Entity + Field + OData | Extensive OData, facets |
