Search Templates

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 

ParameterTypeRequiredDescription
filterObjectNoFilter criteria applied with AND logic.
offsetIntegerNoNumber of records to skip. Default value is 0.
pageSizeIntegerNoNumber of results per page. Default value is 20.
searchObjectNoSearch criteria applied with OR logic across specified fields.
sortbyArrayNoArray of sort clauses.

Filter Object 

1{
2  "filter": {
3    "criteria": [
4      {
5        "field": "Status__c",
6        "operator": "=",
7        "values": "Approved"
8      },
9      {
10        "field": "Category__c",
11        "operator": "IN",
12        "values": "Enterprise,Premium"
13      }
14    ]
15  }
16}

Parameters 

PropertyTypeDescription
criteriaArrayArray of filter criterion objects. All criteria are combined with AND logic.
criteria[].fieldStringThe API name of the field to filter on. Supports SalesConfigTemplate__c fields and relationship fields through TemplateQuoteId__r and TemplateOrderId__r.
criteria[].operatorStringThe comparison operator.
criteria[].valuesStringThe value(s) to compare against. For IN and NOT IN, provide comma-separated values.

Supported Operators 

OperatorDescriptionExample Values
=Equals”Approved”
!=Not equals”Draft”
INValue is in list”Draft,Approved”
NOT INValue is not in list”Obsolete”
LIKEPattern 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.

1{
2  "filter": {
3    "criteria": [
4      {
5        "field": "tags",
6        "operator": "IN",
7        "values": "Internet,Standard"
8      }
9    ]
10  }
11}

Relationship Field Filtering 

You can filter on fields from the related Quote or Order

1{
2  "filter": {
3    "criteria": [
4      {
5        "field": "TemplateQuoteId__r.Name",
6        "operator": "LIKE",
7        "values": "Enterprise"
8      }
9    ]
10  }
11}

Only TemplateQuoteId__r (Quote) and TemplateOrderId__r (Order) relationships are supported.

Note

Search Object 

1{
2  "search": {
3    "fields": "Name,Tags",
4    "value": "fiber"
5  }
6}

Parameters 

PropertyTypeDescription
fieldsStringComma-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.
valueStringThe search term. Automatically wrapped with % wildcards for LIKE queries.

Sort Object 

1{
2  "sortby": [
3    { "field": "Name", "direction": "ASC" },
4    { "field": "CreatedDate", "direction": "DESC" }
5  ]
6}

Parameters 

PropertyTypeDescription
fieldStringThe API name of the field to sort by.
directionString”ASC” (ascending) or “DESC” (descending). Default: “ASC”.

|

Example REST Request: Full Search 

1{
2  "filter": {
3    "criteria": [
4      { "field": "Status__c", "operator": "=", "values": "Approved" },
5      { "field": "Category__c", "operator": "IN", "values": "Enterprise,Premium" }
6    ]
7  },
8  "search": {
9    "fields": "Name,Description__c,tags",
10    "value": "fiber"
11  },
12  "sortby": [
13    { "field": "Name", "direction": "ASC" }
14  ],
15  "pageSize": 10,
16  "offset": 0
17}

Example REST Response 

Success Response (200):

1{
2  "success": true,
3  "errorCode": "INVOKE-200",
4  "error": "OK",
5  "result": {
6    "records": [
7      {
8        "Id": "a1Bxx0000004XyzDEF",
9        "Name": "Enterprise Fiber Bundle",
10        "vlocity_cmt__Description__c": "Standard fiber bundle for enterprise customers",
11        "vlocity_cmt__Status__c": "Approved",
12        "vlocity_cmt__Category__c": "Enterprise",
13        "Tags": ["Enterprise", "Fiber"],
14        "vlocity_cmt__EffectiveOneTimeTotal__c": 299.99,
15        "vlocity_cmt__EffectiveRecurringTotal__c": 89.99,
16        "vlocity_cmt__PriceList__r": {
17          "Id": "a3Dxx0000002GhiJKL",
18          "Name": "Standard Price List",
19          "vlocity_cmt__CurrencyCode__c": "USD"
20        }
21      }
22    ],
23    "messages": []
24  },
25  "totalCount": 1,
26  "offset": 0,
27  "pageSize": 10,
28  "totalPages": 1
29}