Adaptive Search Queries: Saved Searches

You can create saved searches for your common queries. This lets you reuse a query without defining it each time. You can create saved searches based on the access role, or create default saved searches at the role, user, and site-level.

All Saved Searches are assigned Saved Search numbers that can be used to:
  • Get a saved search
  • Update or delete a saved search
  • Export a saved search and import a saved search

You can migrate saved searches between your environments using REST services. REST uses the saved search number to migrate a saved search from one environment to another without losing the reference to the saved search. Keeping the reference the same across environments allows other areas of your sales application such as the Sales Dashboard to be migrated without any reference changes.

Some Saved Searches may not be supported by the objects during synchronization. This may be because the data in the saved search is not available in the database or that the data does not follow the business criteria.

Below is a list of saved searches that are not supported during sync:

  • My Calls to Log
  • My Overdue Tasks

In addition, the following operators are not supported by the synchronization engine:

  • AllOfTheWords

  • AnyOfTheWords

  • NoneOfTheWords

  • FuzzyMatch

Below are sample request payloads to create, update, and delete saved searches for some scenarios:

Scenario Sample Request Payload

Create role-based saved search

{
    "name": "Search Accounts",
    "entity": "Account",
    "access": "Role",
    "roles": [
        "ORA_ZBS_SALES_REPRESENTATIVE_JOB",
        "ORA_ZBS_SALES_MANAGER_JOB"
    ]
}

Create default saved search for a role

cURL Command

http://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries/entityPreferenceForRole

Request Payload

{
    "application": "16d2f11c-29e1-4cf7-8867-7e36080b96d2",
    "roleName": "ORA_ZBS_SALES_ADMINISTRATOR_JOB",
    "entityPreferences": [
        {
            "entity": "Account",
            "queryUuid": "f66e2629-7494-4a4d-b16b-d41fd9391c5a"
        },
        {
            "entity": "Activity",
            "queryUuid": "de850fed-ae4c-40ca-ac7d-f37efe069222"
        }
    ]
}

Create default saved search at the site-level

cURL Command

http://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries/entityPreferenceForSite

Request Payload

{
    "application": "16d2f11c-29e1-4cf7-8867-7e36080b96d2",
    "entityPreferences": [
        {
            "entity": "Account",
            "queryUuid": "f66e2629-7494-4a4d-b16b-d41fd9391c5a"
        },
        {
            "entity": "Activity",
            "queryUuid": "de850fed-ae4c-40ca-ac7d-f37efe069222"
        }
    ]
}

Create default saved search at the user-level

cURL Command

http://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries/entityPreferenceForUser

Request Payload

{
    "application": "16d2f11c-29e1-4cf7-8867-7e36080b96d2",
    "entityPreferences": [
        {
            "entity": "Account",
            "queryUuid": "f66e2629-7494-4a4d-b16b-d41fd9391c5a"
        },
        {
            "entity": "Activity",
            "queryUuid": "de850fed-ae4c-40ca-ac7d-f37efe069222"
        }
    ]
}    
Update a Saved Search

cURL Command

http://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries/59783e65-0513-4169-9fae-db9d7d1b105c?metaModelUuid=81f4c054-90c6-45a0-a096-beec3ad68d42&entity=Account&savedSearchNumber=889937479

Request Payload

{
  "entity": "Account",
  "name": "All Accounts-testing",
  "access": "Private",
  "fields": [
    "PartyId",
    "PartyUniqueName",
    "PrimaryAddress",
    "PrimaryContact",
    "PrimaryIndustry",
    "Owner",
    "DoNotContactFlag",
    "DoNotContactFlag",
    "DoNotContactFlag"
  ],
  "keywords": null,
  "q": null,
  "sort": [
    {
      "attribute": "_score",
      "direction": "descending"
    }
  ],
  "language": "en",
  "keywordsFields": [
    "PartyUniqueName",
    "PrimaryAddress",
    "PrimaryContact",
    "PrimaryIndustry",
    "Owner"
  ],
  "aggregations": null,
  "excludeFields": null,
  "highlights": {
    "pre": [
      "<b>"
    ],
    "post": [
      "</b>"
    ],
    "fields": [
      "PartyUniqueName",
      "PrimaryAddress",
      "PrimaryContact",
      "PrimaryIndustry",
      "Owner"
    ]
  },
  "skipInValidFields": true,
  "applicationData": {
    "461e5791-9f15-4cd1-b5cd-19e8480cbce4": {
      "isListView": true,
      "listLayoutFields": [
        "PartyUniqueName",
        "PrimaryAddress",
        "PrimaryContact",
        "PrimaryIndustry",
        "Owner"
      ],
      "listLayoutFieldWidths": [
        {
          "attribute": "PartyUniqueName",
          "width": 328
        },
        {
          "attribute": "PrimaryAddress",
          "width": 381
        },
        {
          "attribute": "PrimaryContact",
          "width": 218
        },
        {
          "attribute": "PrimaryIndustry",
          "width": 200
        },
        {
          "attribute": "Owner",
          "width": 160
        },
        {
          "attribute": "_actions",
          "width": 76
        }
      ]
    }
  }
}
Delete a Saved Search

cURL Command

http://servername.fa.us2.oraclecloud.com/crmRestApi/searchResources/11.13.18.05/custom-actions/queries/59783e65-0513-4169-9fae-db9d7d1b105c?metaModelUuid=81f4c054-90c6-45a0-a096-beec3ad68d42&entity=Account&savedSearchNumber=889937479

Export an Saved Search API

Request URI:

{{url}}/crmRestApi/searchResources/latest/custom-actions/queries/batch

Request Type: POST

Request Body:
{
savedSearchNumbersList:[ savedSearchNumber1, SavedSearchNumber2,....]
}