Searches, filters, sorts, and paginates Sales Configuration Templates, supporting field-level filtering (AND logic), free-text search (OR logic), tag-based filtering, and multi-field sorting.
Resource Information
- Resource URL:
/services/apexrest/<namespace>/v1/cpq/templates/search - HTTP Method: POST
- Content-Type: application/json
- Response Format: JSON
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| filter | Object | No | Filter criteria applied with AND logic. |
| offset | Integer | No | Number of records to skip. Default value is 0. |
| pageSize | Integer | No | Number of results per page. Default value is 20. |
| search | Object | No | Search criteria applied with OR logic across specified fields. |
| sortby | Array | No | Array of sort clauses. |
Filter Object
{
"filter": {
"criteria": [
{
"field": "Status__c",
"operator": "=",
"values": "Approved"
},
{
"field": "Category__c",
"operator": "IN",
"values": "Enterprise,Premium"
}
]
}
}
Parameters
| Property | Type | Description |
|---|---|---|
| criteria | Array | Array of filter criterion objects. All criteria are combined with AND logic. |
| criteria[].field | String | The API name of the field to filter on. Supports SalesConfigTemplate__c fields and relationship fields through TemplateQuoteId__r and TemplateOrderId__r. |
| criteria[].operator | String | The comparison operator. |
| criteria[].values | String | The value(s) to compare against. For IN and NOT IN, provide comma-separated values. |
Supported Operators
| Operator | Description | Example Values |
|---|---|---|
| = | Equals | "Approved" |
| != | Not equals | "Draft" |
| IN | Value is in list | "Draft,Approved" |
| NOT IN | Value is not in list | "Obsolete" |
| LIKE | Pattern match (auto-adds % wildcards) | "Enterprise" |
| > | Greater than | "2024-01-01" |
| >= | Greater than or equal | "100" |
| < | Less than | "500" |
| <= | Less than or equal | "1000" |
Tag Filtering
To filter templates by tag IDs, use the special field name tagIds with the IN operator.
{
"filter": {
"criteria": [
{
"field": "tags",
"operator": "IN",
"values": "Internet,Standard"
}
]
}
}
Relationship Field Filtering
You can filter on fields from the related Quote or Order
{
"filter": {
"criteria": [
{
"field": "TemplateQuoteId__r.Name",
"operator": "LIKE",
"values": "Enterprise"
}
]
}
}
note: Only TemplateQuoteId__r (Quote) and TemplateOrderId__r (Order) relationships are supported.
Search Object
{
"search": {
"fields": "Name,Tags",
"value": "fiber"
}
}
Parameters
| Property | Type | Description |
|---|---|---|
| fields | String | Comma-separated list of field names to search across. Use Tags to include tag name matching. All fields are searched with OR logic using LIKE matching. |
| value | String | The search term. Automatically wrapped with % wildcards for LIKE queries. |
Sort Object
{
"sortby": [
{ "field": "Name", "direction": "ASC" },
{ "field": "CreatedDate", "direction": "DESC" }
]
}
Parameters
| Property | Type | Description |
|---|---|---|
| field | String | The API name of the field to sort by. |
| direction | String | "ASC" (ascending) or "DESC" (descending). Default: "ASC". |
|
Example REST Request: Full Search
{
"filter": {
"criteria": [
{ "field": "Status__c", "operator": "=", "values": "Approved" },
{ "field": "Category__c", "operator": "IN", "values": "Enterprise,Premium" }
]
},
"search": {
"fields": "Name,Description__c,tags",
"value": "fiber"
},
"sortby": [
{ "field": "Name", "direction": "ASC" }
],
"pageSize": 10,
"offset": 0
}
Example REST Response
Success Response (200):
{
"success": true,
"errorCode": "INVOKE-200",
"error": "OK",
"result": {
"records": [
{
"Id": "a1Bxx0000004XyzDEF",
"Name": "Enterprise Fiber Bundle",
"vlocity_cmt__Description__c": "Standard fiber bundle for enterprise customers",
"vlocity_cmt__Status__c": "Approved",
"vlocity_cmt__Category__c": "Enterprise",
"Tags": ["Enterprise", "Fiber"],
"vlocity_cmt__EffectiveOneTimeTotal__c": 299.99,
"vlocity_cmt__EffectiveRecurringTotal__c": 89.99,
"vlocity_cmt__PriceList__r": {
"Id": "a3Dxx0000002GhiJKL",
"Name": "Standard Price List",
"vlocity_cmt__CurrencyCode__c": "USD"
}
}
],
"messages": []
},
"totalCount": 1,
"offset": 0,
"pageSize": 10,
"totalPages": 1
}